public function html()
 {
     $path = $this->path;
     if ($this->current) {
         $path[] = PsHtml::span(array(), $this->current);
     }
     return empty($path) ? '' : PsHtml::div(array('class' => 'ps-page-nav'), implode('', $path));
 }
Exemple #2
0
 private function spanImpl($itemName, array $attrs = array(), $class = null)
 {
     $attrs['class'] = to_array(array_get_value('class', $attrs));
     $attrs['class'][] = $class;
     $attrs['class'][] = 'sprite';
     $attrs['class'][] = 'sprite-' . $this->name;
     $attrs['class'][] = 'sprite-' . $this->name . '-' . $itemName;
     return PsHtml::span($attrs);
 }
Exemple #3
0
 public final function smallOfficeLiContent()
 {
     $title = $this->getTitle();
     $state = '';
     if ($this instanceof NumerableOfficePage) {
         $state = $this->getNumericState();
         $state = $state ? PsHtml::span(array('class' => 'cnt'), "({$state})") : null;
         $HREF['class'][] = 'stetable';
     }
     $coverRel = $this->foldedEntity->getCover()->getRelPath();
     $HREF['style'] = array('background-image' => "url({$coverRel})");
     //return "<a class=\"$ident ip-opener\" title=\"$title\" href=\"#$ident\">$title</a> $count";
     return $this->getIdentPageHref($HREF, "{$title}{$state}");
 }
Exemple #4
0
function smarty_modifier_fsize($size, $short = false)
{
    if ($size < 1024) {
        echo $short ? "{$size} бт" : "{$size} байт";
    } else {
        if ($size < 1024 * 1024) {
            $size = round($size / 1024, 2);
            echo $short ? "{$size} кб" : "{$size} килобайт";
        } else {
            $size = round($size / (1024 * 1024), 2);
            echo PsHtml::span(array('class' => 'red'), $short ? "{$size} мб" : "{$size} мегабайт");
        }
    }
}
Exemple #5
0
 /**
  * Спан-ссылка для отображения картинки во всплывающем bubble.
  * <span data-folded-item-unique="lib-s-einstein" data-loader="folding" class="ps-bubblehref-stick folded">Эйнштейн</span>
  */
 public static function spanFoldedEntityBubble($content, $unique, array $attrs = array())
 {
     self::attrsLoader($attrs, PsConstJs::BUBBLE_LOADER_FOLDING);
     $attrs['class'] = to_array(array_get_value('class', $attrs));
     $attrs['class'][] = 'folded';
     $attrs['data'][PsConstJs::BUBBLE_LOADER_FOLDING_DATA] = $unique;
     return PsHtml::span($attrs, $content);
 }
 /**
  * Метод строит html листочка на дереве дискуссии:
  * 
  * <li>
  * ....
  *    <ul>
  *       <li>
  *       ....
  *       </li>
  *    </ul>
  * </li>
  * 
  * @param DiscussionMsg $msg
  */
 public final function buildLeaf(DiscussionMsg $msg, $simple = false)
 {
     $msgId = $msg->getId();
     $author = $msg->getUser();
     $isDeleted = $msg->isDeleted();
     $isUserComment = $author->isAuthorised();
     $isCanConfirm = !$isUserComment && !$msg->isConfirmed() && !$isDeleted && AuthManager::isAuthorizedAsAdmin();
     $notKnown = !$msg->isKnown() && $msg->getUserTo() && $msg->getUserTo()->isIt(PsUser::instOrNull());
     $msgUnique = $msg->getUnique();
     $threadUnique = $this->SETTINGS->getThreadUnique($msg->getThreadId());
     //Мы открываем страницу для показа этого комментария
     $liId = RequestArrayAdapter::inst()->str(GET_PARAM_GOTO_MSG) === $msgUnique ? " id=\"{$msgUnique}\"" : '';
     //Классы li
     $liClasses = array('msg');
     if ($isDeleted) {
         $liClasses[] = 'deleted';
     }
     //Классы Comment
     $divClasses = array('comment', $msgUnique);
     if ($isUserComment) {
         $divClasses[] = 'user_comment';
     }
     if ($isCanConfirm) {
         $divClasses[] = 'not_confirmed';
     }
     //Данные для Comment
     $divData['unique'] = $msgUnique;
     //Имя пользователя
     $userName = $author->getName() . ($isUserComment ? ' (вы)' : '');
     //КНОПКИ УПРАВЛЕНИЯ СВЕРХУ
     $controlsTop = array();
     if (!$simple) {
         //Кнопки управления сверху
         $controlsTop[] = PsHtml::a(array('href' => '#'), '#');
         if (!$msg->isRoot()) {
             $controlsTop[] = PsHtml::a(array('href' => '#', 'class' => 'parent'), '↑');
         }
     }
     //Кнопки голосования
     if ($this->SETTINGS->isVotable()) {
         $userCanVote = AuthManager::isAuthorized() && !$isUserComment;
         $votes = VotesManager::inst()->getVotesCount($threadUnique, $msgId);
         $likeCtrl = array();
         if ($userCanVote) {
             $vote = VotesManager::inst()->getUserVotes($threadUnique, $msgId, AuthManager::getUserId());
             $likeCtrl[] = PsHtml::a(array('class' => 'like ' . ($vote > 0 ? 'active' : 'clickable')), '+1');
             $likeCtrl[] = PsHtml::a(array('class' => 'votes' . ($vote == 0 ? '' : ' clickable') . ($votes == 0 ? '' : ($votes > 0 ? ' green' : ' red'))), abs($votes));
             $likeCtrl[] = PsHtml::a(array('class' => 'dislike ' . ($vote < 0 ? 'active' : 'clickable')), '−1');
         } else {
             $likeCtrl[] = PsHtml::a(array('class' => 'votes' . ($votes == 0 ? '' : ($votes > 0 ? ' green' : ' red'))), abs($votes));
         }
         $controlsTop[] = PsHtml::span(array('class' => 'vote'), implode('', $likeCtrl));
     }
     $controlsTop = implode('', $controlsTop);
     //КНОПКИ УПРАВЛЕНИЯ СНИЗУ
     $controlsBottom = '';
     if (!$simple && !$isDeleted) {
         $controlsBottom = array();
         $controlsBottom['id'] = $msgId;
         if ($isCanConfirm) {
             $controlsBottom[SmartyFunctions::ACTION_CONFIRM] = 'Принять';
         }
         if (!$msg->isMaxDeepLevel()) {
             $controlsBottom[SmartyFunctions::ACTION_REPLY] = 'Ответить';
         }
         if ($isUserComment) {
             $controlsBottom[SmartyFunctions::ACTION_DELETE] = 'Удалить';
         } elseif (AuthManager::isAuthorizedAsAdmin()) {
             $controlsBottom[SmartyFunctions::ACTION_DELETE] = 'Удалить (админ)';
         }
         $controlsBottom = SmartyFunctions::psctrl($controlsBottom);
     }
     //Собираем параметры в кучу
     $params['msg'] = $msg;
     $params['new'] = $notKnown;
     $params['builder'] = $this;
     $params['liId'] = $liId;
     $params['liClasses'] = implode(' ', $liClasses);
     $params['divClasses'] = implode(' ', $divClasses);
     $params['divData'] = PsHtml::data2string($divData);
     $params['msgId'] = $msgId;
     $params['simple'] = $simple;
     $params['avatar'] = $author->getAvatarImg('42x', array('class' => 'small'));
     $params['userName'] = $userName;
     $params['controlsTop'] = $controlsTop;
     $params['controlsBottom'] = $controlsBottom;
     if ($msg->isTemplated()) {
         $params['msgCtt'] = TemplateMessages::inst()->decodeTemplateMsg($msg);
     } else {
         $params['msgCtt'] = $msg;
     }
     return PSSmarty::template('discussion/common/leaf.tpl', $params)->fetch();
 }
Exemple #7
0
 /**
  * Метод возвращает span с номером для ссылки на элемент нумерации
  */
 public static function numeratorHrefIndex($css, $num)
 {
     return PsHtml::span(array('class' => $css . '-href-index'), $num);
 }
Exemple #8
0
 /**
  * GET параметры. Нужно называть аккуратно, так как может быть пересечение с $_POST параметрами формы
  */
 public function title()
 {
     $cnt = TableExporter::inst()->getModifiedTablesCount();
     return 'Работа с таблицами БД' . ($cnt ? ' ' . PsHtml::span(array('class' => 'small'), "({$cnt})") : '');
 }
Exemple #9
0
 public static function textInfo($label, $value, $help = null)
 {
     return self::field($label, PsHtml::span(array('class' => 'input'), UserInputTools::unsafeText($value)), $help);
 }