function basePageHref($basePageCode, $image)
{
    $basePage = WebPage::inst($basePageCode);
    $sprites = CssSpritesManager::getDirSprite(CssSpritesManager::DIR_HEADER, $image, true);
    $href = $basePage->getHref($sprites . $basePage->getName());
    echo PsHtml::html2('li', array('class' => WebPages::getCurPage()->isMyBasePage($basePage) ? 'current' : null), $href);
}
Exemple #2
0
 public static function textarea($label, $name, $content, $maxlen, $manual, $codemirror, array $attrs = array(), $help = null)
 {
     $attrs['name'] = $name;
     $attrs['cols'] = 20;
     $attrs['rows'] = 110;
     if (is_numeric($maxlen) && $maxlen > 0) {
         /*
          * ml вместо maxlength используем потому, что некоторые браузеры (например firefox)
          * самостоятельно начинают накладывать ограничение на кол-во вводимых символов.
          * Нам же нужно, чтобы пользователь мог вводить текст и был просто предупреждён о
          * превышениилимита. Валидацию произведёт валидатор форм.
          */
         $attrs['ml'] = 1 * $maxlen;
     }
     if ($manual) {
         $attrs['manual'] = 1;
     }
     if ($codemirror) {
         $attrs['codemirror'] = PsCodemirror::checkType($codemirror);
     }
     /*
      * Выполним unsafe, чтобы, например, текст "α" не был заменён на "α" в браузере
      */
     $content = UserInputTools::unsafeText($content);
     $textarea = PsHtml::html2('textarea', $attrs, $content);
     return self::field($label, $textarea, $help);
 }
Exemple #3
0
 /**
  * Метод получает фактический контект для всплывающей страницы.
  * Сама страница может вернуть или IdentPageFilling, и тогда содержимое 
  * будет обработано за неё. Или непосредственно IdentPageContent,
  * если ей самой нужно обработать содержимое (например - акции).
  * 
  * @return ClientBoxContent
  */
 public final function getContent()
 {
     if ($this->cbContent) {
         return $this->cbContent;
     }
     $this->checkAccess();
     $this->profilerStart(__FUNCTION__);
     $filling = null;
     try {
         $filling = $this->getClientBoxFilling();
         check_condition($filling instanceof ClientBoxFilling, "Элемент [{$this->ident}] обработан некорректно");
     } catch (Exception $ex) {
         $this->profilerStop(false);
         return $this->cbContent = new ClientBoxContent(PsHtml::divErr(ExceptionHandler::getHtml($ex)));
     }
     //Построим заголовок
     $HEAD_PARAMS['class'][] = 'box-header';
     if ($filling->isCover()) {
         $HEAD_PARAMS['class'][] = 'covered';
         $HEAD_PARAMS['style']['background-image'] = 'url(' . $this->foldedEntity->getCover()->getRelPath() . ')';
     }
     $HEAD_CONTENT = $filling->getHref() ? PsHtml::a(array('href' => $filling->getHref()), $filling->getTitle()) : $filling->getTitle();
     $HEAD = PsHtml::html2('h3', $HEAD_PARAMS, $HEAD_CONTENT);
     $BOX_CONTENT = $this->foldedEntity->fetchTplWithResources($filling->getSmartyParams());
     $BOX = PsHtml::div(array(), $HEAD . $BOX_CONTENT);
     $this->profilerStop();
     return $this->cbContent = new ClientBoxContent($BOX, $filling->getJsParams());
 }
function smarty_function_chess_fugure($params, Smarty_Internal_Template &$template)
{
    // Постановка фигуры на доску
    $x = $params['x'];
    $y = $params['y'];
    $value = '';
    $figure = '';
    $data = array();
    $class = array();
    if ($y == 0 || $y == 9) {
        switch ($x) {
            case 1:
                $value = 'A';
                break;
            case 2:
                $value = 'B';
                break;
            case 3:
                $value = 'C';
                break;
            case 4:
                $value = 'D';
                break;
            case 5:
                $value = 'E';
                break;
            case 6:
                $value = 'F';
                break;
            case 7:
                $value = 'G';
                break;
            case 8:
                $value = 'H';
                break;
        }
    } else {
        if ($x == 0 || $x == 9) {
            $value = $y;
        } else {
            $class[] = ($x + $y) % 2 == 0 ? 'even' : 'odd';
            $figs = $template->getTemplateVars('figures');
            $pos = $x . $y;
            //Позиция фигуры, например a6
            if (is_array($figs) && array_key_exists($pos, $figs)) {
                $figure = $figs[$pos];
                $value = "<span class=\"{$figure}\"></span>";
            }
        }
    }
    return PsHtml::html2('td', array('class' => $class), $value);
}
Exemple #5
0
function smarty_block_ol($params, $content, Smarty_Internal_Template &$smarty)
{
    if (isEmpty($content)) {
        return;
        //---
    }
    $params['class'] = to_array(array_get_value('class', $params));
    $params['class'][] = 'block_ol';
    $strings = explode("\n", trim($content));
    $lis = array();
    foreach ($strings as $string) {
        if (!isEmpty($string)) {
            $lis[] = '<li>' . trim($string) . '</li>';
        }
    }
    $content = join('', $lis);
    return PsHtml::html2('ol', $params, $content);
}
 public function getHtml(array $attrs = array())
 {
     $attrs['id'] = 'adminPages';
     $attrs['class'][] = 'sections';
     return PsHtml::html2('ul', $attrs, $this->html);
 }