示例#1
0
 function process_ajax()
 {
     $c = $this->getRootComponent();
     $c->process();
     $content = $this->stripIdFromContent(parent::getContent());
     $timeline = array('date' => array(), 'type' => 'default');
     $num = count($content['records']);
     if ($this->type == 'chronologic') {
         for ($i = 0; $i < $num; $i++) {
             $term = $content['records'][$i]['term'];
             $temp = array('headline' => '', 'text' => '', 'asset' => array('media' => '', 'caption' => '', 'credit' => ''));
             $temp['headline'] = $term->term;
             if ($term->dateFrom) {
                 $temp['startDate'] = $this->formatDate($term->dateFrom);
             }
             if ($term->dateTo) {
                 $temp['endDate'] = $this->formatDate($term->dateTo);
             }
             $temp['text'] = '';
             foreach ($content['records'][$i]['taggedDocuments'] as $doc) {
                 $temp['text'] = __Link::makeSimpleLink($doc['title'], $doc['url']) . '<br/>';
             }
             $timeline['date'][] = $temp;
         }
     }
     return array('timeline' => $timeline);
 }