function _formatBible($raw, $linked = FALSE)
 {
     if ($raw) {
         $br = new Bible_Ref($raw);
         return $linked ? $br->getLinkedShortString() : $br->toShortString();
     }
     return '';
 }
Beispiel #2
0
 function getFormattedValue($fieldname)
 {
     switch ($fieldname) {
         case 'bible_to_read':
         case 'bible_to_preach':
             $type = substr($fieldname, strlen('bible_to_'));
             $readings = $this->getRawBibleReadings('read');
             $res = array();
             foreach ($readings as $reading) {
                 $br = new Bible_Ref($reading['bible_ref']);
                 $res[] = $br->toShortString();
             }
             return implode(', ', $res);
             break;
         case 'bible_all':
             $readings = $this->getRawBibleReadings();
             $res = array();
             foreach ($readings as $reading) {
                 $br = new Bible_Ref($reading['bible_ref']);
                 $entry = $br->toShortString();
                 if (!$reading['to_read']) {
                     $entry = '(' . $entry . ')';
                 }
                 if ($reading['to_preach']) {
                     $entry = '<strong>' . $entry . '</strong>';
                 }
                 $res[] = $entry;
             }
             return implode(', ', $res);
             break;
         case 'format_title':
         case 'topic_title':
             return $this->values[$fieldname];
             break;
         case 'summary':
             $res = array();
             if ($this->values['topic_title']) {
                 $res[] = $this->values['topic_title'];
             }
             if ($b = $this->getFormattedValue('bible_all')) {
                 $res[] = $b;
             }
             if ($this->values['format_title']) {
                 $res[] = $this->values['format_title'];
             }
             if ($this->values['notes']) {
                 $res[] = $this->values['notes'];
             }
             return implode("\n", $res);
             break;
         default:
             if (strpos($fieldname, 'comps_') === 0) {
                 $compCatID = (int) substr($fieldname, 6);
                 $res = array();
                 foreach ($this->getItems(FALSE, $compCatID) as $item) {
                     $res[] = ents($item['title']);
                 }
                 return implode("\n", $res);
             } else {
                 return parent::getFormattedValue($fieldname);
             }
     }
 }