-
Notifications
You must be signed in to change notification settings - Fork 1
/
PeoplePicker.j
40 lines (35 loc) · 1.11 KB
/
PeoplePicker.j
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
@import <Foundation/CPObject.j>
@import "THRPicker.j"
@import "Person.j"
@implementation PeoplePicker : THRPicker
{
}
- (id) objectFromJSON:(CPString) jsonString
{
var addressesArray = jsonString.addresses.split("::");
var person = [[Person alloc] init];
person.index=jsonString.id;
person.name = jsonString.name;
person.surname = jsonString.surname;
person.companyName = jsonString.companyName;
person.isCompany = [jsonString.isCompany intValue];
for( var j=0;j<addressesArray.length-1;j++ )
{
var addressArray = addressesArray[j].split(";");
var dictionaryEntry = [[DictionaryEntry alloc] initWithValue:addressArray[1] forKey:addressArray[2]];
[person.addresses addObject:dictionaryEntry];
}
return person;
}
- (CPString) urlWithSearchString:(CPString) searchText
{
var url = nil;
if( [searchText length]>2)
url=[CPString stringWithFormat:@"https://iscrizioni.iltemporitrovato.org/gestione/PHP/contacts.php?task=LISTING&search=%@",searchText];
return url;
}
- (CPString) descriptionForObject:(id)aObject
{
return [aObject fullName];
}
@end