Permalink
Browse files

integracion de pdf y videos

  • Loading branch information...
1 parent 9107904 commit 0e131911ee9dde5272b81ca3543b89096346f8a2 @stoicdavid committed Dec 12, 2011
@@ -7,8 +7,6 @@
objects = {
/* Begin PBXBuildFile section */
- 17A854631495ABB300C0B901 /* TicagrelorMecanismodeAccion.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 17A854611495ABB300C0B901 /* TicagrelorMecanismodeAccion.mp4 */; };
- 17A854641495ABB300C0B901 /* VideoCorazon.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 17A854621495ABB300C0B901 /* VideoCorazon.mp4 */; };
17FF58A6149583E20056C21F /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 17FF58A5149583E20056C21F /* MediaPlayer.framework */; };
17FF58AD149588DC0056C21F /* ResourceView.m in Sources */ = {isa = PBXBuildFile; fileRef = 17FF58AC149588DC0056C21F /* ResourceView.m */; };
AA038D22149495CC00667A09 /* ListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AA038D20149495CC00667A09 /* ListViewController.m */; };
@@ -67,6 +65,10 @@
AAA3EEAD14956A8500DFFE8A /* AVOEtarjetonATORVASTATINA.pdf in Resources */ = {isa = PBXBuildFile; fileRef = AAA3EEAB14956A8500DFFE8A /* AVOEtarjetonATORVASTATINA.pdf */; };
AAA3EEAE14956A8500DFFE8A /* AVOEtarjetonesCOMBINACION.pdf in Resources */ = {isa = PBXBuildFile; fileRef = AAA3EEAC14956A8500DFFE8A /* AVOEtarjetonesCOMBINACION.pdf */; };
AAA3EEC9149588D100DFFE8A /* ResourceManager.m in Sources */ = {isa = PBXBuildFile; fileRef = AAA3EEC8149588D100DFFE8A /* ResourceManager.m */; };
+ AAA3EEE61495B97400DFFE8A /* TicagrelorMecanismodeAccion.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = AAA3EEE41495B97400DFFE8A /* TicagrelorMecanismodeAccion.mp4 */; };
+ AAA3EEE71495B97400DFFE8A /* VideoCorazon.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = AAA3EEE51495B97400DFFE8A /* VideoCorazon.mp4 */; };
+ AAA3EEE91495B98200DFFE8A /* FlatAZMexico_H264.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = AAA3EEE81495B98200DFFE8A /* FlatAZMexico_H264.mp4 */; };
+ AAA3EEEB1495B98B00DFFE8A /* FlatAZMexico_02.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = AAA3EEEA1495B98B00DFFE8A /* FlatAZMexico_02.mp4 */; };
AAF0BE9F14949B3400CB887D /* ResourceViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = AAF0BE9D14949B3400CB887D /* ResourceViewController.xib */; };
AAF0BEA014949B3400CB887D /* ResourceViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AAF0BE9E14949B3400CB887D /* ResourceViewController.m */; };
AAF0BF9D1495606700CB887D /* QuickLook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AAF0BF9C1495606700CB887D /* QuickLook.framework */; };
@@ -75,8 +77,6 @@
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
- 17A854611495ABB300C0B901 /* TicagrelorMecanismodeAccion.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; name = TicagrelorMecanismodeAccion.mp4; path = Recursos/1.Brilinta/Videos/TicagrelorMecanismodeAccion.mp4; sourceTree = "<group>"; };
- 17A854621495ABB300C0B901 /* VideoCorazon.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; name = VideoCorazon.mp4; path = Recursos/1.Brilinta/Videos/VideoCorazon.mp4; sourceTree = "<group>"; };
17FF58A5149583E20056C21F /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = System/Library/Frameworks/MediaPlayer.framework; sourceTree = SDKROOT; };
17FF58AB149588DC0056C21F /* ResourceView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceView.h; sourceTree = "<group>"; };
17FF58AC149588DC0056C21F /* ResourceView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ResourceView.m; sourceTree = "<group>"; };
@@ -143,6 +143,10 @@
AAA3EEAC14956A8500DFFE8A /* AVOEtarjetonesCOMBINACION.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = AVOEtarjetonesCOMBINACION.pdf; sourceTree = "<group>"; };
AAA3EEC7149588D100DFFE8A /* ResourceManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceManager.h; sourceTree = "<group>"; };
AAA3EEC8149588D100DFFE8A /* ResourceManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ResourceManager.m; sourceTree = "<group>"; };
+ AAA3EEE41495B97400DFFE8A /* TicagrelorMecanismodeAccion.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = TicagrelorMecanismodeAccion.mp4; sourceTree = "<group>"; };
+ AAA3EEE51495B97400DFFE8A /* VideoCorazon.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = VideoCorazon.mp4; sourceTree = "<group>"; };
+ AAA3EEE81495B98200DFFE8A /* FlatAZMexico_H264.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = FlatAZMexico_H264.mp4; sourceTree = "<group>"; };
+ AAA3EEEA1495B98B00DFFE8A /* FlatAZMexico_02.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = FlatAZMexico_02.mp4; sourceTree = "<group>"; };
AAF0BE9C14949B3400CB887D /* ResourceViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceViewController.h; sourceTree = "<group>"; };
AAF0BE9D14949B3400CB887D /* ResourceViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ResourceViewController.xib; sourceTree = "<group>"; };
AAF0BE9E14949B3400CB887D /* ResourceViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ResourceViewController.m; sourceTree = "<group>"; };
@@ -337,6 +341,8 @@
AAA3EEA01495656500DFFE8A /* Video */ = {
isa = PBXGroup;
children = (
+ AAA3EEE41495B97400DFFE8A /* TicagrelorMecanismodeAccion.mp4 */,
+ AAA3EEE51495B97400DFFE8A /* VideoCorazon.mp4 */,
);
name = Video;
sourceTree = "<group>";
@@ -353,8 +359,8 @@
AAA3EEA31495659600DFFE8A /* Video */ = {
isa = PBXGroup;
children = (
- 17A854611495ABB300C0B901 /* TicagrelorMecanismodeAccion.mp4 */,
- 17A854621495ABB300C0B901 /* VideoCorazon.mp4 */,
+ AAA3EEEA1495B98B00DFFE8A /* FlatAZMexico_02.mp4 */,
+ AAA3EEE81495B98200DFFE8A /* FlatAZMexico_H264.mp4 */,
);
name = Video;
sourceTree = "<group>";
@@ -478,8 +484,10 @@
AAA3EEAA14956A4500DFFE8A /* RAEstudioPlato.PDF in Resources */,
AAA3EEAD14956A8500DFFE8A /* AVOEtarjetonATORVASTATINA.pdf in Resources */,
AAA3EEAE14956A8500DFFE8A /* AVOEtarjetonesCOMBINACION.pdf in Resources */,
- 17A854631495ABB300C0B901 /* TicagrelorMecanismodeAccion.mp4 in Resources */,
- 17A854641495ABB300C0B901 /* VideoCorazon.mp4 in Resources */,
+ AAA3EEE61495B97400DFFE8A /* TicagrelorMecanismodeAccion.mp4 in Resources */,
+ AAA3EEE71495B97400DFFE8A /* VideoCorazon.mp4 in Resources */,
+ AAA3EEE91495B98200DFFE8A /* FlatAZMexico_H264.mp4 in Resources */,
+ AAA3EEEB1495B98B00DFFE8A /* FlatAZMexico_02.mp4 in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -7,6 +7,7 @@
//
#import <UIKit/UIKit.h>
+#import "ResourceManager.h"
#define pdf @"pdf"
#define video @"mp4"
@@ -17,8 +18,10 @@
UITableView *table;
NSMutableDictionary *resourceList;
NSString *fileType;
+ int productType;
}
+@property (nonatomic) int productType;
@property (nonatomic, retain) UIButton *dismissButton;
@property (nonatomic, retain) IBOutlet UITableView *table;
@property (nonatomic, retain) NSMutableDictionary *resourceList;
@@ -12,7 +12,7 @@
#import "HelperViewController.h"
@implementation ListViewController
-@synthesize dismissButton,table, resourceList, fileType;
+@synthesize dismissButton,table, resourceList, fileType, productType;
-(IBAction) dismiss{
[self dismissModalViewControllerAnimated:YES];
@@ -23,10 +23,12 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
- self.resourceList = [NSMutableDictionary dictionary];
- [self.resourceList setObject:@"TicagrelorMecanismodeAccion"
- forKey:@"Ticagrelor Mecanismo de Acción"];
- [self.resourceList setObject:@"VideoCorazon" forKey:@"Video Corazón"];
+
+
+// self.resourceList = [NSMutableDictionary dictionary];
+// [self.resourceList setObject:@"TicagrelorMecanismodeAccion"
+// forKey:@"Ticagrelor Mecanismo de Acción"];
+// [self.resourceList setObject:@"VideoCorazon" forKey:@"Video Corazón"];
}
return self;
}
@@ -44,34 +46,37 @@ - (void)didReceiveMemoryWarning
- (void)viewDidLoad
{
[super viewDidLoad];
- int yPos = 200;
- for (NSString* key in [resourceList allKeys]) {
- ResourceView *resourceView = [[ResourceView alloc] initWithFrame:CGRectMake(300, yPos, 500, 50)
- withLocalResponder:self
- withTitle:key
- andFileName:[resourceList objectForKey:key]];
- [self.view addSubview:resourceView];
- yPos += 60;
- }
+// int yPos = 200;
+// for (NSString* key in [resourceList allKeys]) {
+// ResourceView *resourceView = [[ResourceView alloc] initWithFrame:CGRectMake(300, yPos, 500, 50)
+// withLocalResponder:self
+// withTitle:key
+// andFileName:[resourceList objectForKey:key]];
+// [self.view addSubview:resourceView];
+// yPos += 60;
+// }
}
+
+
- (void) pushResourceViewControllerWithFile:(NSString*)file
{
+
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle]
pathForResource:file ofType:fileType]];
-
+
if (fileType == pdf) {
QLPreviewController *controlador1 = [[QLPreviewController alloc] init];
HelperViewController *dummy = [[HelperViewController alloc] init];
-
- dummy.documents=file;
+
+ dummy.documents=[file stringByAppendingString:[NSString stringWithFormat:@".%@",fileType ]];
controlador1.dataSource =dummy;
controlador1.delegate=dummy;
controlador1.currentPreviewItemIndex =0;
-
+
[self presentModalViewController:controlador1 animated:YES];
-
+
[controlador1 release];
} else {
MPMoviePlayerViewController *movController = [[MPMoviePlayerViewController alloc]
@@ -82,21 +87,43 @@ - (void) pushResourceViewControllerWithFile:(NSString*)file
- (void) setResourceIconForButtonTag:(int)tag
{
+ ResourceManager *manager = [[ResourceManager alloc]init];
+
NSString *resource = Nil;
fileType = pdf;
if (tag == 1) {
- resource = @"botonVideos.png";
- fileType = video;
+ resource = @"botonAyudaVisual.png";
+
+ self.resourceList = [[NSMutableDictionary alloc ] initWithDictionary:[manager visualAidsByProduct:self.productType]];
+
+
} else if(tag == 2) {
resource = @"botonMaterialesExtra.png";
+ self.resourceList = [[NSMutableDictionary alloc ] initWithDictionary:[manager extrasByProduct:self.productType]];
+
} else if(tag == 3) {
- resource = @"botonAyudaVisual.png";
+ self.resourceList = [[NSMutableDictionary alloc ] initWithDictionary:[manager videosByProduct:self.productType]];
+ resource = @"botonVideos.png";
+ fileType = video;
+
}
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:resource]];
[imageView setFrame:CGRectMake(33, 203, imageView.frame.size.width, imageView.frame.size.height)];
[self.view addSubview:imageView];
+
+ int yPos = 200;
+ for (NSString* key in [resourceList allKeys]) {
+
+ ResourceView *resourceView = [[ResourceView alloc] initWithFrame:CGRectMake(300, yPos, 500, 50)
+ withLocalResponder:self
+ withTitle:key
+ andFileName:[resourceList objectForKey:key]];
+ [self.view addSubview:resourceView];
+ yPos += 60;
+ }
+
}
- (void)viewDidUnload
@@ -25,12 +25,12 @@ - (id) init
resources = [[NSMutableArray alloc] init];
//Brilinta
- aids = [[NSArray alloc] initWithObjects:@"AVBrilinta.pdf", nil];
- aidsK = [[NSArray alloc] initWithObjects:[NSNumber numberWithInt:1], nil];
- extras = [[NSArray alloc] initWithObjects:@"RAEstudioPlato.PDF", nil];
- extrasK = [[NSArray alloc] initWithObjects:[NSNumber numberWithInt:1], nil] ;
- videos = [[NSArray alloc] initWithObjects:@"TicagrelorMecanismodeAccion.mp4",@"VideoCorazon.mp4", nil];
- videosK = [[NSArray alloc] initWithObjects:[NSNumber numberWithInt:1],[NSNumber numberWithInt:1], nil] ;
+ aids = [[NSArray alloc] initWithObjects:@"AVBrilinta", nil];
+ aidsK = [[NSArray alloc] initWithObjects:@"Apoyo Visual Brilinta", nil];
+ extras = [[NSArray alloc] initWithObjects:@"RAEstudioPlato", nil];
+ extrasK = [[NSArray alloc] initWithObjects:@"Recurso Adicional Estudio Plato", nil] ;
+ videos = [[NSArray alloc] initWithObjects:@"TicagrelorMecanismodeAccion",@"VideoCorazon", nil];
+ videosK = [[NSArray alloc] initWithObjects:@"Ticagrelor Mecanismo de Acción",@"Video Corazón", nil] ;
aidsD = [[NSDictionary alloc] initWithObjects:aids forKeys:aidsK];
extrasD = [[NSDictionary alloc] initWithObjects:extras forKeys:extrasK];
videosD = [[NSDictionary alloc] initWithObjects:videos forKeys:videosK];
@@ -39,31 +39,29 @@ - (id) init
[resources addObject:aidsD];
[resources addObject:extrasD];
[resources addObject:videosD];
- NSLog(@"%@",videosD);
+
[resources addObject:@"111"];
[products setObject:resources forKey:[NSNumber numberWithInt:1]];
- NSLog(@"RECURSOS%@",resources.description);
- NSLog(@"PRODUCTOS%@",products.description);
+ NSLog([[resources objectAtIndex:1] description]);
[self eraseResources];
//Crestor
- aids = [[NSArray alloc] initWithObjects:@"AVOEtarjetonATORVASTATINA.pdf",@"AVOEtarjetonesCOMBINACION.pdf", nil];
- aidsK = [[NSArray alloc] initWithObjects:[NSNumber numberWithInt:1],[NSNumber numberWithInt:2], nil];
- videos = [[NSArray alloc] initWithObjects:@"FlatAZMexico_H264.mp4", nil];
- videosK = [[NSArray alloc] initWithObjects:[NSNumber numberWithInt:1], nil] ;
+ aids = [[NSArray alloc] initWithObjects:@"AVOEtarjetonATORVASTATINA",@"AVOEtarjetonesCOMBINACION", nil];
+ aidsK = [[NSArray alloc] initWithObjects:@"Apoyo Visual OE tarjeton ATORVASTATINA",@"Apoyo Visual tarjetones COMBINACION", nil];
+ videos = [[NSArray alloc] initWithObjects:@"FlatAZMexico_H264", nil];
+ videosK = [[NSArray alloc] initWithObjects:@"Flat AZ Mexico_H264", nil] ;
aidsD = [[NSDictionary alloc] initWithObjects:aids forKeys:aidsK];
videosD = [[NSDictionary alloc] initWithObjects:videos forKeys:videosK];
[resources addObject:@"Crestor"];
[resources addObject:aidsD];
- NSLog(@"%@",aidsD);
+
[resources addObject:videosD];
- NSLog(@"%@",videosD);
+
[resources addObject:@"101"];
[products setObject:resources forKey:[NSNumber numberWithInt:2]];
- NSLog(@"RECURSOS%@",resources.description);
- NSLog(@"PRODUCTOS%@",products.description);
+
[self eraseResources];
//Onglyza
@@ -80,8 +78,7 @@ - (id) init
[resources addObject:extrasD];
[resources addObject:@"110"];
[products setObject:resources forKey:[NSNumber numberWithInt:3]];
- NSLog(@"RECURSOS%@",resources.description);
- NSLog(@"PRODUCTOS%@",products.description);
+
[self eraseResources];
@@ -186,8 +183,9 @@ - (id) init
- (BOOL) productHasVisualAids:(int)product{
NSArray *temp = [products objectForKey:[NSNumber numberWithInt:product]];
NSString *vector = [temp objectAtIndex:temp.count-1];
- NSString *value = [vector substringToIndex:0];
+ NSString *value = [vector substringWithRange:NSMakeRange(0, 1)];
if ([value isEqualToString:@"1"]){
+
return YES;
}else{
return NO;
@@ -196,8 +194,9 @@ - (BOOL) productHasVisualAids:(int)product{
- (BOOL) productHasExtras:(int)product{
NSArray *temp = [products objectForKey:[NSNumber numberWithInt:product]];
NSString *vector = [temp objectAtIndex:temp.count-1];
- NSString *value = [vector substringToIndex:1];
+ NSString *value = [vector substringWithRange:NSMakeRange(1, 1)];
if ([value isEqualToString:@"1"]){
+
return YES;
}else{
return NO;
@@ -207,8 +206,9 @@ - (BOOL) productHasExtras:(int)product{
- (BOOL) productHasVideos:(int)product{
NSArray *temp = [products objectForKey:[NSNumber numberWithInt:product]];
NSString *vector = [temp objectAtIndex:temp.count-1];
- NSString *value = [vector substringToIndex:2];
+ NSString *value = [vector substringWithRange:NSMakeRange(2, 1)];
if ([value isEqualToString:@"1"]){
+
return YES;
}else{
return NO;
@@ -46,6 +46,7 @@ - (id) initWithFrame:(CGRect)frame withLocalResponder:(ListViewController *)cont
- (void) invokeControllerViewPush
{
+ NSLog(fileName);
[localResponder performSelector:@selector(pushResourceViewControllerWithFile:) withObject:fileName];
}
@@ -15,9 +15,10 @@
UIButton *dismissButton;
UIButton *resourceButton;
UIImageView *logo;
-
+ int productType;
}
+@property (nonatomic) int productType;
@property (nonatomic, retain) IBOutlet UIImageView *logo;
@property (nonatomic, retain) UIButton *dismissButton;
@property (nonatomic, retain) UIButton *resourceButton;
@@ -9,7 +9,7 @@
#import "ResourceViewController.h"
@implementation ResourceViewController
-@synthesize dismissButton,resourceButton,logo;
+@synthesize dismissButton,resourceButton,logo,productType;
-(IBAction) dismiss{
[self dismissModalViewControllerAnimated:YES];
@@ -18,7 +18,7 @@ -(IBAction) dismiss{
-(IBAction) listResources:(id) sender {
ListViewController *list = [[ListViewController alloc] initWithNibName:@"ListViewController" bundle:nil];
list.modalTransitionStyle=UIModalTransitionStyleCrossDissolve;
-
+ list.productType = self.productType;
[list setResourceIconForButtonTag:[sender tag]];
[self presentModalViewController:list animated:YES];
}
Oops, something went wrong.

0 comments on commit 0e13191

Please sign in to comment.