Пример #1
0
 public function getMetaDescriptionParts($preset = false)
 {
     $output = array();
     if ($this->getData('items_count')) {
         $output[] = pl_dopelniacz($this->getData('items_count'), 'dokument', 'dokumenty', 'dokument�w');
     } else {
         $output[] = 'Kolekcja jest pusta';
     }
     return $output;
 }
Пример #2
0
 public function getMetaDescriptionParts($preset = false)
 {
     $output = array();
     if ($this->getDate()) {
         $output[] = dataSlownie($this->getDate());
     }
     if ($this->getData('liczba_dokumentow')) {
         $output[] = pl_dopelniacz($this->getData('liczba_dokumentow'), 'dokument', 'dokumenty', 'dokumentów');
     }
     return $output;
 }
Пример #3
0
 public function getMetaDescriptionParts($preset = false)
 {
     $output = array(dataSlownie($this->getDate()));
     if ($this->getData('sejm_debaty.liczba_wystapien')) {
         $output[] = pl_dopelniacz($this->getData('sejm_debaty.liczba_wystapien'), 'wystąpienie', 'wystąpienia', 'wystąpień');
     }
     if ($this->getData('sejm_debaty.liczba_glosowan')) {
         $output[] = pl_dopelniacz($this->getData('sejm_debaty.liczba_glosowan'), 'głosowanie', 'głosowania', 'głosowań');
     }
     return $output;
 }
 public function getMetaDescriptionParts($preset = false)
 {
     $output = array();
     if ($this->getData('liczba_obserwujacych')) {
         $output[] = pl_dopelniacz($this->getData('liczba_obserwujacych'), 'obserwujący', 'obserwujących', 'obserwujących');
     }
     if ($this->getData('liczba_tweetow')) {
         $output[] = pl_dopelniacz($this->getData('liczba_tweetow'), 'tweet', 'tweety', 'tweetów');
     }
     return $output;
 }
Пример #5
0
 public function wiek($data)
 {
     return pl_dopelniacz(pl_wiek($data), 'rok', 'lata', 'lat');
 }
 public function getHTMLForField($field, $field_params, $options = array())
 {
     $output = '';
     $normalizeText = false;
     $col_width = isset($options['col_width']) ? $options['col_width'] : 4;
     $hidden = isset($options['hidden']) ? $options['hidden'] : false;
     $field_label = $field_params['label'];
     $field_value = $field_params['value'];
     $field_options = isset($field_params['options']) && is_array($field_params['options']) ? $field_params['options'] : array();
     $field_type = $field_params['type'];
     if (stripos($field, 'data') === 0) {
         $field_type = 'date';
     }
     if ($field_type == 'date' && !isset($field_options['format'])) {
         if ($field_value == '0000-00-00') {
             return false;
         }
         $field_value = dataSlownie($field_value);
     } elseif ($field_type == 'pln') {
         $field_value = (double) $field_value;
         if (!$field_value) {
             return false;
         }
         $field_value = number_format_h($field_value, 2, ',', ' ') . ' PLN';
     } elseif ($field_type == 'integer') {
         if (!$field_value) {
             return false;
         } else {
             $field_value = number_format($field_value, 0, '', ' ');
         }
     } elseif ($field_type == 'percent') {
         $field_value .= '%';
     } elseif ($field_type == 'duration') {
         if (!$field_value) {
             return false;
         } else {
             $field_value = number_format($field_value, 0, '', ' ') . 'm';
         }
     } elseif ($field_type == 'vote') {
         $field_value = '<div class="voted btn btn-default btn-glos-' . $field_value . '" data-glos="' . $field_value . '">' . $this->voted($field_value) . '</div>';
     }
     if (isset($field_options['format'])) {
         switch ($field_options['format']) {
             case 'wiek':
                 $field_value = pl_dopelniacz(pl_wiek($field_value), 'rok', 'lata', 'lat');
                 break;
             case 'bytes':
                 $field_value = round($field_params['value'] / 1024);
                 $field_value = number_format($field_value, 0, '', ' ') . 'kB';
                 break;
         }
     }
     if (isset($field_options['dictionary'])) {
         if (is_array($field_value)) {
             if (!empty($field_value)) {
                 foreach ($field_value as &$v) {
                     $v = @$field_options['dictionary'][$v];
                 }
             }
         } else {
             $field_value = @$field_options['dictionary'][$field_value];
         }
     }
     if (isset($field_options['truncate'])) {
         $base_part = mb_substr($field_value, 0, $field_options['truncate']);
         $add_part = mb_substr($field_value, $field_options['truncate']);
         $field_value = '<span class="base">' . $base_part . '</span>';
         if ($add_part) {
             $field_value .= ' <a href="#" onclick="return false;">...</a><span class="add">' . $add_part . '</span>';
         }
     }
     if (isset($field_options['img'])) {
         if (preg_match_all('/\\{\\$(.*?)\\}/i', $field_options['img'], $matches)) {
             for ($m = 0; $m < count($matches[0]); $m++) {
                 $field_value = '<img src="' . str_replace($matches[0][$m], $this->object->getData($matches[1][$m]), $field_options['img']) . '" /> ' . $field_value;
             }
         }
     }
     if (isset($field_options['normalizeText']) && $field_options['normalizeText']) {
         $normalizeText = true;
     }
     if (isset($field_options['link'])) {
         if (is_array($field_options['link']) && isset($field_options['link']['dataset']) && isset($field_options['link']['object_id'])) {
             if (is_array($field_value)) {
                 for ($f = 0; $f < count($field_value); $f++) {
                     $object_id = $field_options['link']['object_id'][0] == '$' ? $this->object->getData(mb_substr($field_options['link']['object_id'], 1)) : $field_options['link']['object_id'];
                     $object_id = @$object_id[$f];
                     $href = '/dane/' . $field_options['link']['dataset'] . '/' . $object_id;
                     $field_value[$f] = '<a href="' . $href . '">' . $field_value[$f] . '</a>';
                 }
             } else {
                 $object_id = $field_options['link']['object_id'][0] == '$' ? $this->object->getData(mb_substr($field_options['link']['object_id'], 1)) : $field_options['link']['object_id'];
                 $href = '/dane/' . $field_options['link']['dataset'] . '/' . $object_id;
                 $field_value = '<a href="' . $href . '">' . $field_value . '</a>';
             }
         } elseif (is_array($field_options['link']) && $field_options['link']['href']) {
             $href = $field_options['link']['href'][0] == '$' ? $this->object->getData(mb_substr($field_options['link']['href'], 1)) : $field_options['link']['href'];
             $_field_value = $field_value;
             $field_value = '<a';
             if (isset($field_options['link']['newWindow']) && $field_options['link']['newWindow']) {
                 $field_value .= ' target="_blank"';
             }
             $field_value .= ' href="' . $href . '">' . $_field_value . '</a>';
         }
     }
     if (isset($field_options['dopelniacz'])) {
         $field_value = pl_dopelniacz($field_value, $field_options['dopelniacz'][0], $field_options['dopelniacz'][1], $field_options['dopelniacz'][2]);
     }
     if (!empty($field_value)) {
         if (!is_array($field_value) && stripos($field_value, $field_label) === 0) {
             $field_value = trim(mb_substr($field_value, strlen($field_label)));
         }
         $output .= '<div class="dataHighlight';
         if ($col_width) {
             $output .= ' col-md-' . $col_width;
         }
         if ($hidden) {
             $output .= ' secondRow';
         }
         $output .= '"';
         $output .= '>';
         if ($field_label && !isset($field_options['hide']) && $field_type != 'vote') {
             $output .= '<p class="_label">' . $field_label . ':</p>';
         }
         $output .= '<p class="_value';
         if ($normalizeText) {
             $output .= ' normalizeText';
         }
         $output .= '">';
         if (is_array($field_value)) {
             $output .= '<ul class="hl_ul normalizeText"><li>' . implode('</li><li>', $field_value) . '</li></ul>';
         } else {
             $output .= $field_value;
         }
         $output .= '</p></div>';
     }
     return $output;
 }