Created
November 19, 2012 06:23
-
-
Save malebolgia/4109234 to your computer and use it in GitHub Desktop.
Json for timeline using awesome timeline.verite js CakePHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
createStoryJS({ | |
type: 'timeline', | |
width: '700', | |
height: '600', | |
start_at_slide: '4', | |
hash_bookmark: true, | |
start_zoom_adjust: '-1', | |
source: '/jsonexports/event_workshop_timeline', | |
embed_id: 'event-timeline', | |
debug: false | |
}); | |
</script> | |
<div id = "event-timeline" > | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function event_workshop_timeline(){ | |
$this->loadModel('Event'); | |
$getEvents = $this->Event->find('all',array('conditions' => array('Event.status' => 1))); | |
//ReFormat for Json | |
foreach ($getEvents as $getEvent) { | |
$jsonTimeline[] = array('startDate' => date("Y,m,d",strtotime($getEvent['Event']['start_date'])), | |
'endDate' => date("Y,m,d",strtotime($getEvent['Event']['end_date'])), | |
'headline' => $getEvent['Event']['title'], | |
'text' => $getEvent['EventType']['title'], | |
'asset' => array( "media" => "/images/static.png", | |
"credit" => "Location: ".$getEvent['Event']['location'], | |
"thumbnail" => "/images/static.png", | |
"caption" => "<i class = 'cus-book'></i> Test" | |
) | |
); | |
} | |
$json_data = array('timeline' => array( 'headline' => Configure::read('timeline.headline'), | |
'type' => Configure::read('timeline.type'), | |
'text' => Configure::read('timeline.text'), | |
'startDate' => Configure::read('timeline.startDate'), | |
'date' => $jsonTimeline | |
) | |
); | |
echo json_encode($json_data); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment