Comments (17)
My solution is currently this:
$types = array();
foreach ($tel->parameters as $param) {
if ($param->name == 'TYPE') {
$types[] = $param->value;
}
}
Bit scrappy but seems to work.
from vobject.
Hi!
This looks like a valid way to do this. Another way would be:
$types = array();
if (isset($tel['TYPE'])) {
foreach($tel['TYPE'] as $type) {
$types[] = (string)$type;
}
}
from vobject.
Closing this, just comment here if you have any other questions.
from vobject.
Thanks.
from vobject.
How do you go about accessing groups and then adding groups?
Trying to support the X-ABLabel, can't seem to find much reference anywhere.
from vobject.
Properties in a specific group will be fetched the same way as regular properties. There's one issue though:
$obj->group.TEL
Is not valid, so you use this instead:
$obj->{'group.TEL'}
from vobject.
How would you subsequently write those back?
E.g.
item1.TEL:9999999999
item1.X-ABLabel:new type
Presumably you could have:
item2.TEL etc
Is it item1 that's the group or TEL with a property of X-ABLabel?
thanks for your help.
Tom
from vobject.
Hi Tom,
Whatever is before the .
is the group. Apple addressbook which properties belong together (TEL, X-ABLabel) based on this group. Does that make sense?
from vobject.
Kind of :)
I can't quite yet work out how I read that property of the TEL and how I use add method to put it back in.
Still, all good fun!
from vobject.
To update something, it's just:
$vcard->{'item1.TEL'} = 'new phone number';
from vobject.
Cool thanks, I've managed to read them out now fine.
Do I have to handle the numbering of item1, 2 etc or can I do it through using:
\Sabre\VObject\Component::create('vcard');
With add method and serialize?
Tom
from vobject.
No you are responsible for numbering. It's kind of an OS X addressbook-specific feature, so it didn't make sense in a generic library.
from vobject.
Thanks for all your help. Yeah that makes sense.
from vobject.
Since the subject opened here: I've been trying to figure if there is a way to query if there are any groups in a vobject/vcard and how to get a list of them? It's not very handy to have to test for item1 to itemN ;) This is possibly so obvious that I have missed it.
from vobject.
In that case the only way is to just loop through them, and check the ->group
property.
from vobject.
Ah, ->group
is a property. I had missed that. I thought you used it as an example only, but looking at the source of course it's there
from vobject.
:)
from vobject.
Related Issues (20)
- Text Property `strtr(): Argument #1 ($string) must be of type string, array given` HOT 2
- Clear way to decode Property params and value HOT 4
- Invalid vCard date-time string HOT 2
- PHP 8.2 utf8_encode deprecated
- RDATE PERIOD with TZID doesn't seem to be recognised
- ITip/Broker and plus signs in email addresses HOT 1
- Importing Greek vCard with UTF-8 jumbled on iOS 16
- Impossibility to send attendee invitations for events in shared calendars
- Add TimeZone "Amsterdam, Berlin, Bern, Rom, Stockholm, Wien" HOT 2
- Yearly recurrence with negative BYWEEKNO HOT 1
- CATEGORIES only comma escaped list HOT 1
- RRule Yearly with BYMONTH and BYDAY parts not calculating correctly HOT 4
- implode(): Passing null to parameter #1 ($separator) of type array|string is deprecated HOT 3
- can no longer parse outlook.office.com ics shares HOT 1
- createProperty: check if parameter VALUE is a string
- PHP Deprecated: strtoupper(): Passing null to parameter #1 ($string) of type string is deprecated HOT 1
- parser error when DATE is empty HOT 7
- Dst leap is passed on to subsequent occurrences of recuring events HOT 12
- Parse an iCal calendar, how to get all events? HOT 2
- Fatal error when passing NULL to the Reader HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vobject.