ziedinjsh Posted April 22, 2017 Report Share Posted April 22, 2017 Sveiki, mēģinu palaist uz android kalendāru savu .ics failu, bet android nenolasa. Caur online ics validatoru man parādu šādu kļūdu: Missing VCALENDAR object near line # 1Reference: RFC 5545 3.4 iCalendar Object Mans kods: require_once('src/idiorm/dbase.php'); header("Content-Type: text/Calendar"); header("Content-Disposition: inline; filename=filename.ics"); $calendar =' BEGIN:VCALENDAR\n PRODID:-//kkas/kkas//v 0.1//LV VERSION:2.0\n METHOD:PUBLISH\n X-MS-OLK-FORCEINSPECTOROPEN:TRUE\n'; $events = ORM::for_table('events')->find_many(); foreach($events as $event){ $id = $event->id; $uid = $event->uid; $startdate = $event->startdate; $enddate = $event->startdate; $title = $event->title; $desc = $event->description; $addtime = $event->addtime; $modifed = $event->last_modifed; $calendar .='BEGIN:VEVENT\n CLASS:PUBLIC\n CREATED:'.$addtime.'\n DESCRIPTION:'.$desc.'\n DTSTAMP:'.$addtime.'\n DTSTART:'.$startdate.'\n DTEND:'.$startdate.'\n LAST-MODIFIED:'.$modifed.'\n LOCATION:\n PRIORITY:5\n SEQUENCE:0\n SUMMARY:LANGUAGE=lv:'.$title.'\n TRANSP:OPAQUE\n UID:'.$id.'\n X-MICROSOFT-CDO-BUSYSTATUS:BUSY\n X-MICROSOFT-CDO-IMPORTANCE:1\n X-MICROSOFT-DISALLOW-COUNTER:FALSE\n X-MS-OLK-ALLOWEXTERNCHECK:TRUE\n X-MS-OLK-AUTOFILLLOCATION:FALSE\n X-MS-OLK-CONFTYPE:0\n END:VEVENT\n'; } $calendar .='END:VCALENDAR'; echo $calendar; ?> Es īstiu nesaprotu kas nav pareizi! P.S. Paldies jau iepriekš. Quote Link to comment Share on other sites More sharing options...
Zefirs Posted April 22, 2017 Report Share Posted April 22, 2017 Nemācēšu pateikt kur ir kļūda, bet kad es krāmējos ar ics, tad galā nonācu pie vienas ics php bibliotēkas, kas ļāva ērti visu oop stipā salikt. Iesaku neizgudrot riteni no jauna un pamēģināt atrast kādu gatavu libu. Beigās arī varēsi salīdzināt output starp savu un bibl. kodu, gan jau arī tad kļūdu pamanīsi. Quote Link to comment Share on other sites More sharing options...
ieleja Posted April 22, 2017 Report Share Posted April 22, 2017 un ja paskatās tā jauniegūtā .ICS faila saturu, izskatās tāds pats kā izeksportēts no kādas kalendāra programmas, uz MACa kaut vai 'Calendar'? un tas izeksportētais validējas? Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted April 23, 2017 Author Report Share Posted April 23, 2017 (edited) Diemžēl man nav Mac ierīce, lai notestētu. Pamiģināju šo libu. Vienu eventu viņš izveido un viss ir ok, bet kā lai viņu iestutēju iekš foreach, lai man vienā *.ics failā nav pie katra eventa BEGIN:VCALENDAR, bet gan BEGIN:EVENT??? Tālāk netieku $events = ORM::for_table('events')->find_many(); $data = array(); $ics = new ICS($data); foreach($events as $event){ $data[] = array( 'location' => 'Mājās', 'description' => $event->description, 'dtstart' => $event->startdate, 'dtend' => $event->startdate, 'summary' => $event->title, 'url' => '' ); } Edited April 23, 2017 by ziedinjsh Quote Link to comment Share on other sites More sharing options...
Kasspars Posted April 26, 2017 Report Share Posted April 26, 2017 Problēma izskatās ir tajā, ka tu newline simbolu \n raksti single pēdiņas. PHP visi special chari jāraksta ir dubultajās pēdiņās Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.