diff --git a/FestivalHelper.xcodeproj/project.pbxproj b/FestivalHelper.xcodeproj/project.pbxproj index 953c0de..6d3073b 100644 --- a/FestivalHelper.xcodeproj/project.pbxproj +++ b/FestivalHelper.xcodeproj/project.pbxproj @@ -7,6 +7,9 @@ objects = { /* Begin PBXBuildFile section */ + 303A457E19BAEE51003C8860 /* FESFilmEntry.m in Sources */ = {isa = PBXBuildFile; fileRef = 303A457D19BAEE51003C8860 /* FESFilmEntry.m */; }; + 303A458119BB07BC003C8860 /* FESFilmEntryCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 303A458019BB07BC003C8860 /* FESFilmEntryCell.m */; }; + 303A458419BB0C44003C8860 /* FESFilmsTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 303A458319BB0C44003C8860 /* FESFilmsTableViewController.m */; }; 3068700719B2D6B1007E4A0E /* FESSCheduleEntry.m in Sources */ = {isa = PBXBuildFile; fileRef = 3068700619B2D6B1007E4A0E /* FESSCheduleEntry.m */; }; 3068700A19B2F826007E4A0E /* FESScheduleFilm.m in Sources */ = {isa = PBXBuildFile; fileRef = 3068700919B2F826007E4A0E /* FESScheduleFilm.m */; }; 3068700D19B5AB16007E4A0E /* FESScheduleTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3068700C19B5AB16007E4A0E /* FESScheduleTableViewController.m */; }; @@ -43,6 +46,12 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 303A457C19BAEE51003C8860 /* FESFilmEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FESFilmEntry.h; path = films/FESFilmEntry.h; sourceTree = ""; }; + 303A457D19BAEE51003C8860 /* FESFilmEntry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FESFilmEntry.m; path = films/FESFilmEntry.m; sourceTree = ""; }; + 303A457F19BB07BC003C8860 /* FESFilmEntryCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FESFilmEntryCell.h; path = films/FESFilmEntryCell.h; sourceTree = ""; }; + 303A458019BB07BC003C8860 /* FESFilmEntryCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FESFilmEntryCell.m; path = films/FESFilmEntryCell.m; sourceTree = ""; }; + 303A458219BB0C44003C8860 /* FESFilmsTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FESFilmsTableViewController.h; path = films/FESFilmsTableViewController.h; sourceTree = ""; }; + 303A458319BB0C44003C8860 /* FESFilmsTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FESFilmsTableViewController.m; path = films/FESFilmsTableViewController.m; sourceTree = ""; }; 3068700519B2D6B1007E4A0E /* FESSCheduleEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FESSCheduleEntry.h; path = schedule/FESSCheduleEntry.h; sourceTree = ""; }; 3068700619B2D6B1007E4A0E /* FESSCheduleEntry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FESSCheduleEntry.m; path = schedule/FESSCheduleEntry.m; sourceTree = ""; }; 3068700819B2F826007E4A0E /* FESScheduleFilm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FESScheduleFilm.h; path = schedule/FESScheduleFilm.h; sourceTree = ""; }; @@ -106,6 +115,19 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 303A457B19BAEE1F003C8860 /* films */ = { + isa = PBXGroup; + children = ( + 303A457C19BAEE51003C8860 /* FESFilmEntry.h */, + 303A457D19BAEE51003C8860 /* FESFilmEntry.m */, + 303A457F19BB07BC003C8860 /* FESFilmEntryCell.h */, + 303A458019BB07BC003C8860 /* FESFilmEntryCell.m */, + 303A458219BB0C44003C8860 /* FESFilmsTableViewController.h */, + 303A458319BB0C44003C8860 /* FESFilmsTableViewController.m */, + ); + name = films; + sourceTree = ""; + }; 3068700419B2D4C7007E4A0E /* schedule */ = { isa = PBXGroup; children = ( @@ -180,6 +202,7 @@ 3CEA73C219B1A86D00076FC5 /* FestivalHelper */ = { isa = PBXGroup; children = ( + 303A457B19BAEE1F003C8860 /* films */, 3068702419B8C00E007E4A0E /* common */, 3068701A19B86EF4007E4A0E /* venues */, 3068700419B2D4C7007E4A0E /* schedule */, @@ -319,9 +342,12 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 303A457E19BAEE51003C8860 /* FESFilmEntry.m in Sources */, + 303A458119BB07BC003C8860 /* FESFilmEntryCell.m in Sources */, 3068700D19B5AB16007E4A0E /* FESScheduleTableViewController.m in Sources */, 3068702019B88054007E4A0E /* FESVenueEntryCell.m in Sources */, 3CEA73C919B1A86D00076FC5 /* main.m in Sources */, + 303A458419BB0C44003C8860 /* FESFilmsTableViewController.m in Sources */, 3068702719B8C03E007E4A0E /* FESDataProvider.m in Sources */, 3068701319B6301C007E4A0E /* FESScheduleEntryCell.m in Sources */, 3068701919B6F135007E4A0E /* FESScheduleFilmCell.m in Sources */, diff --git a/FestivalHelper/Base.lproj/Main.storyboard b/FestivalHelper/Base.lproj/Main.storyboard index 5c6d938..fe89ac7 100644 --- a/FestivalHelper/Base.lproj/Main.storyboard +++ b/FestivalHelper/Base.lproj/Main.storyboard @@ -149,16 +149,16 @@ - + - - + + - + - @@ -206,22 +210,56 @@ - + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + @@ -235,6 +273,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FestivalHelper/FestivalHelper-Prefix.pch b/FestivalHelper/FestivalHelper-Prefix.pch index 71ab858..d11333a 100644 --- a/FestivalHelper/FestivalHelper-Prefix.pch +++ b/FestivalHelper/FestivalHelper-Prefix.pch @@ -18,7 +18,9 @@ #if(URL_LOCAL==1) #define SCHEDULE_URL @"http://127.0.0.1:8080/sff2014/schedule.json?local" #define VENUES_URL @"http://127.0.0.1:8080/sff2014/venues.json?local" + #define FILMS_URL @"http://127.0.0.1:8080/sff2014/films.json?local" #else #define SCHEDULE_URL @"http://localhost:8080/sff2014/schedule.json?remote" #define VENUES_URL @"http://localhost:8080/sff2014/venues.json?remote" + #define FILMS_URL @"http://localhost:8080/sff2014/films.json?remote" #endif diff --git a/FestivalHelper/films/FESFilmEntry.h b/FestivalHelper/films/FESFilmEntry.h new file mode 100644 index 0000000..a7e4dab --- /dev/null +++ b/FestivalHelper/films/FESFilmEntry.h @@ -0,0 +1,26 @@ +// +// FESFilmEntry.h +// FestivalHelper +// +// Created by Hamo Hapic on 06/09/14. +// Copyright (c) 2014 Senad Uka. All rights reserved. +// + +#import + +@interface FESFilmEntry : NSObject + +@property (assign) NSInteger filmId; +@property (strong) NSString *filmTitle; +@property (strong) NSString *filmTitleTranslation; +@property (strong) NSString *filmProgram; +@property (strong) NSString *filmDate; +@property (strong) NSString *filmTime; +@property (strong) NSString *filmYear; +@property (strong) NSString *filmDescription; +@property (strong) NSString *filmDirectors; +@property (strong) NSString *filmTagLines; + +-(id)initWithJSONData:(NSDictionary*)filmData; + +@end diff --git a/FestivalHelper/films/FESFilmEntry.m b/FestivalHelper/films/FESFilmEntry.m new file mode 100644 index 0000000..b48b33f --- /dev/null +++ b/FestivalHelper/films/FESFilmEntry.m @@ -0,0 +1,44 @@ +// +// FESFilmEntry.m +// FestivalHelper +// +// Created by Hamo Hapic on 06/09/14. +// Copyright (c) 2014 Senad Uka. All rights reserved. +// + +#import "FESFilmEntry.h" + +@implementation FESFilmEntry + +@synthesize filmId; +@synthesize filmDate; +@synthesize filmDescription; +@synthesize filmDirectors; +@synthesize filmProgram; +@synthesize filmTagLines; +@synthesize filmTime; +@synthesize filmTitle; +@synthesize filmTitleTranslation; +@synthesize filmYear; + + +-(id)initWithJSONData:(NSDictionary*)filmData{ + self = [super init]; + if(self){ + //NSLog(@"initWithJSONData method called"); + self.filmId = [[filmData objectForKey:@"id"] integerValue]; + self.filmTitle = [filmData objectForKey:@"title"]; + self.filmTitleTranslation = [filmData objectForKey:@"titleTranslation"]; + self.filmYear = [filmData objectForKey:@"year"]; + self.filmDate = [filmData objectForKey:@"date"]; + self.filmTime = [filmData objectForKey:@"time"]; + self.filmTagLines = [filmData objectForKey:@"tagLine"]; + self.filmDescription = [filmData objectForKey:@"description"]; + self.filmDirectors = [filmData objectForKey:@"directors"]; + self.filmProgram = [filmData objectForKey:@"program"]; + } + return self; +} + + +@end diff --git a/FestivalHelper/films/FESFilmEntryCell.h b/FestivalHelper/films/FESFilmEntryCell.h new file mode 100644 index 0000000..2389453 --- /dev/null +++ b/FestivalHelper/films/FESFilmEntryCell.h @@ -0,0 +1,19 @@ +// +// FESFilmEntryCell.h +// FestivalHelper +// +// Created by Hamo Hapic on 06/09/14. +// Copyright (c) 2014 Senad Uka. All rights reserved. +// + +#import + +@interface FESFilmEntryCell : UITableViewCell + +@property (weak, nonatomic)IBOutlet UILabel *filmTitle; +@property (weak, nonatomic)IBOutlet UILabel *filmYear; +@property (weak, nonatomic)IBOutlet UILabel *filmDirectors; + + + +@end diff --git a/FestivalHelper/films/FESFilmEntryCell.m b/FestivalHelper/films/FESFilmEntryCell.m new file mode 100644 index 0000000..328eb3d --- /dev/null +++ b/FestivalHelper/films/FESFilmEntryCell.m @@ -0,0 +1,40 @@ +// +// FESFilmEntryCell.m +// FestivalHelper +// +// Created by Hamo Hapic on 06/09/14. +// Copyright (c) 2014 Senad Uka. All rights reserved. +// + +#import "FESFilmEntryCell.h" + +@implementation FESFilmEntryCell + + +@synthesize filmDirectors; +@synthesize filmTitle; +@synthesize filmYear; + + +- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier +{ + self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; + if (self) { + // Initialization code + } + 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/FestivalHelper/films/FESFilmsTableViewController.h b/FestivalHelper/films/FESFilmsTableViewController.h new file mode 100644 index 0000000..a91c920 --- /dev/null +++ b/FestivalHelper/films/FESFilmsTableViewController.h @@ -0,0 +1,15 @@ +// +// FESFilmsTableViewController.h +// FestivalHelper +// +// Created by Hamo Hapic on 06/09/14. +// Copyright (c) 2014 Senad Uka. All rights reserved. +// + +#import + +@interface FESFilmsTableViewController : UITableViewController + +@property (strong)NSMutableArray *filmsArray; + +@end diff --git a/FestivalHelper/films/FESFilmsTableViewController.m b/FestivalHelper/films/FESFilmsTableViewController.m new file mode 100644 index 0000000..e8b6bab --- /dev/null +++ b/FestivalHelper/films/FESFilmsTableViewController.m @@ -0,0 +1,147 @@ +// +// FESFilmsTableViewController.m +// FestivalHelper +// +// Created by Hamo Hapic on 06/09/14. +// Copyright (c) 2014 Senad Uka. All rights reserved. +// + +#import "FESFilmsTableViewController.h" +#import "FESFilmEntry.h" +#import "FESDataProvider.h" +#import "FESFilmEntryCell.h" + +@interface FESFilmsTableViewController () + +@end + +@implementation FESFilmsTableViewController + +@synthesize filmsArray; + +- (id)initWithStyle:(UITableViewStyle)style +{ + self = [super initWithStyle:style]; + if (self) { + // Custom initialization + } + return self; +} + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + [FESDataProvider getDataFromServerForUrl:FILMS_URL andProcessThemWith:^(NSData *data) { + [self setupFilmsFromJSONArray:data]; + [self.tableView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO]; + }]; + +} + + +-(void)setupFilmsFromJSONArray:(NSData*)dataFromServerArray{ + NSError *error; + self.filmsArray = [[NSMutableArray alloc] init]; + NSArray *arrayFromServer = [NSJSONSerialization JSONObjectWithData:dataFromServerArray options:0 error:&error]; + + if(error){ + NSLog(@"error parsing the json data from server with error description - %@", [error localizedDescription]); + } + else { + self.filmsArray = [[NSMutableArray alloc] init]; + for(NSDictionary *filmData in arrayFromServer) + { + FESFilmEntry *entry = [[FESFilmEntry alloc] initWithJSONData:filmData]; + [self.filmsArray addObject:entry]; + } + NSLog(@"success!"); + } +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +#pragma mark - Table view data source + +- (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 [filmsArray count]; +} + + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + UITableViewCell *retrievedCell = [tableView dequeueReusableCellWithIdentifier:@"filmEntryCell" forIndexPath:indexPath]; + FESFilmEntryCell *cell = (FESFilmEntryCell *)retrievedCell; + FESFilmEntry *film = [filmsArray objectAtIndex:indexPath.row]; + + cell.filmDirectors.text = film.filmDirectors; + cell.filmTitle.text = film.filmTitle; + cell.filmYear.text = film.filmYear; + + + return cell; +} + + +/* +// Override to support conditional editing of the table view. +- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath +{ + // Return NO if you do not want the specified item to be editable. + return YES; +} +*/ + +/* +// Override to support editing the table view. +- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath +{ + if (editingStyle == UITableViewCellEditingStyleDelete) { + // Delete the row from the data source + [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; + } else if (editingStyle == UITableViewCellEditingStyleInsert) { + // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view + } +} +*/ + +/* +// Override to support rearranging the table view. +- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath +{ +} +*/ + +/* +// Override to support conditional rearranging of the table view. +- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath +{ + // Return NO if you do not want the item to be re-orderable. + return YES; +} +*/ + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender +{ + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/FestivalHelper/venues/FESVenuesTableViewController.m b/FestivalHelper/venues/FESVenuesTableViewController.m index caa612e..7646fb2 100644 --- a/FestivalHelper/venues/FESVenuesTableViewController.m +++ b/FestivalHelper/venues/FESVenuesTableViewController.m @@ -33,7 +33,7 @@ [super viewDidLoad]; [FESDataProvider getDataFromServerForUrl:VENUES_URL andProcessThemWith:^(NSData *data) { - [self setupScheduleFromJSONArray:data]; + [self setupVenuesFromJSONArray:data]; [self.tableView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO]; }]; @@ -65,7 +65,7 @@ } --(void)setupScheduleFromJSONArray:(NSData*)dataFromServerArray{ +-(void)setupVenuesFromJSONArray:(NSData*)dataFromServerArray{ NSError *error; self.venuesArray = [[NSMutableArray alloc] init]; NSArray *arrayFromServer = [NSJSONSerialization JSONObjectWithData:dataFromServerArray options:0 error:&error]; diff --git a/tools/testbackend/sff2014/films.json b/tools/testbackend/sff2014/films.json new file mode 100644 index 0000000..c0b8c8b --- /dev/null +++ b/tools/testbackend/sff2014/films.json @@ -0,0 +1,40 @@ +[ + { + "id": 1, + "title": "Amores Perros", + "titleTranslation": "Love's a Bitch", + "program": "HT Eronet Open Air", + "date": "15.8.2014.", + "time": "20:30", + "year": "2014", + "description": "lorem ipsum a lot of text lorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of text", + "directors": "Alejandro Gonzalez Iharritu", + "tagLine": "2000, MEXICO, 15O MIN, COLOR, SPANISH" + }, + { + "id": 2, + "title": "20 000 Days on Earth", + "titleTranslation": "20 000 Days on Earth", + "program": "Novi Grad Cinema", + "date": "16.8.2014.", + "time": "20:30", + "year": "2014", + "description": "lorem ipsum a lot of text lorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of text", + "directors": "First Name, Second Name", + "tagLine": "2010, USA, 16O MIN, COLOR, ENGLISH" + }, + { + "id": 3, + "title": "24 Party People", + "titleTranslation": "24 Party People", + "program": "Novi Grad Cinema", + "date": "17.8.2014.", + "time": "21:30", + "year": "2014", + "description": "lorem ipsum a lot of text lorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of textlorem ipsum a lot of text", + "directors": "Third Name, Fourth Name", + "tagLine": "2013, USA, 90 MIN, COLOR, ENGLISH" + + } + +] \ No newline at end of file diff --git a/tools/testbackend/sff2014/venues.json b/tools/testbackend/sff2014/venues.json index 7210fd2..7ea8e78 100644 --- a/tools/testbackend/sff2014/venues.json +++ b/tools/testbackend/sff2014/venues.json @@ -3,43 +3,37 @@ "id": "1", "name": "Summer Theatre HT Eronet", "address": "Gimnazijska bb", - "capacity": "3.000" -}, -{ - "id": "2", - "name": "Summer Theatre HT Eronet", - "address": "Gimnazijska bb", - "capacity": "3.000" + "capacity": "3.000 seats" }, { "id": "3", "name": "Meeting point", "address": "Kresevljakovica 13", - "capacity": "190" + "capacity": "190 seats" }, { "id": "4", "name": "National Theatre", "address": "Obala Kulina Bana 9", - "capacity": "400" + "capacity": "400 seats" }, { "id": "5", "name": "Novi Grad Cinema", "address": "Bulevar Mese Selimovica 97", - "capacity": "300" + "capacity": "300 seats" }, { "id": "6", "name": "Multiplex Cinema City", "address": "Marsala Tita 26", - "capacity": "700" + "capacity": "700 seats" }, { "id": "7", "name": "Lasko Summer Nights", "address": "Hamdije Kresevljakovica 24", - "capacity": "280" + "capacity": "280 seats" }, ] \ No newline at end of file