Exemple #1
0
function smarty_block_p($params, $content, Smarty_Internal_Template &$smarty)
{
    if (isEmpty($content)) {
        return;
    }
    $styles = array();
    $align = value_Array('al', $params);
    switch ($align) {
        case 'l':
            $styles['text-align'] = 'left';
            break;
        case 'c':
            $styles['text-align'] = 'center';
            break;
        case 'r':
            $styles['text-align'] = 'right';
            break;
    }
    $bold = !isEmptyInArray('bold', $params);
    if ($bold) {
        $styles['font-weight'] = 'bold';
    }
    return PsHtml::p(array('style' => $styles), $content);
}
Exemple #2
0
 /**
  * Преобразование в массив.
  * Возвращает события для отображения на временнОй шкале. Параметры:
  * 
  * [title]       - название события
  * [start]       - начало события, в формате 1985-01-29 или 580 BC
  * [end]         - окончание события, в формате 1985-01-29 ил 500 BC
  * [image]       - картинка события
  * [color]       - цвет полоски
  * [link]        - ссылка
  * [textColor]   - цвет текста
  * [icon]        - иконка для события-точки
  * [description] - текст, показываемый под событием
  * 
  */
 public function toArray()
 {
     $rec = array();
     $rec['title'] = $this->title;
     $rec['start'] = $this->dt_start;
     $rec['image'] = $this->image;
     $rec['textColor'] = $this->textColor;
     /*
      * Все необходимые проверки мы выполняем в классе на момент установки значений, поэтому здесь можем просто собирать установленные значения
      */
     if ($this->link) {
         $rec['link'] = $this->link;
     }
     if ($this->dt_stop) {
         $rec['end'] = $this->dt_stop;
     }
     if ($this->lineColor) {
         $rec['color'] = $this->lineColor;
     }
     if ($this->icon) {
         $rec['icon'] = DirManager::images()->relFilePath('timeline', $this->icon);
     }
     /* Содержимое */
     $rec['description'] = PsHtml::p(array('class' => 'dates'), $this->dates) . $this->content;
     /* Наши данные */
     $this->custom['ident'] = $this->ident;
     $this->custom['interval'] = DatesTools::inst()->toString(DatesTools::TS_NUMBERED, $this->dt_start, $this->dt_stop);
     /* Специфические данные */
     $rec['custom'] = $this->custom;
     return $rec;
 }