コード例 #1
0
ファイル: node.label.php プロジェクト: umonkey/molinos-cms
 /**
  * Добавляет в предварительный просмотр количество отмеченных документов.
  */
 public function getPreviewXML(Context $ctx)
 {
     $result = parent::getPreviewXML($ctx);
     $count = $ctx->db->fetch("SELECT COUNT(*) FROM node WHERE deleted = 0 AND id IN " . "(SELECT nid FROM node__rel WHERE tid = ?) AND class IN " . "(SELECT name FROM node WHERE class = 'type' AND deleted = 0 AND published = 1)", array($this->id));
     if ($count) {
         $message = t('%count (<a href="@url">список</a>)', array('%count' => $count, '@url' => 'admin/content/list?search=tags%3A' . $this->id));
         $result .= html::em('field', array('title' => t('Отмечено документов')), html::em('value', html::cdata($message)));
     }
     return $result;
 }
コード例 #2
0
ファイル: node.poll.php プロジェクト: umonkey/molinos-cms
 public function getPreviewXML(Context $ctx)
 {
     $xml = parent::getPreviewXML($ctx);
     $data = $ctx->db->getResultsKV("option", "count", "SELECT `option`, COUNT(*) AS `count` FROM `node__poll` WHERE `nid` = ? GROUP BY `option`", array($this->id));
     $result = '';
     foreach (self::split($this->answers) as $k => $v) {
         $count = isset($data[$k]) ? $data[$k] : 0;
         $result .= html::em('li', $v . ': ' . $count);
     }
     if (!empty($result)) {
         $value = html::em('value', html::cdata(html::em('ul', $result)));
         $xml .= html::em('field', array('title' => t('Результаты'), 'editurl' => "admin/edit/{$this->id}/answers?destination=" . urlencode(MCMS_REQUEST_URI)), $value);
     }
     return $xml;
 }
コード例 #3
0
ファイル: node.order.php プロジェクト: umonkey/molinos-cms
 /**
  * Формирует таблицу для предварительного просмотра.
  */
 public function getPreviewXML(Context $ctx)
 {
     $xml = parent::getPreviewXML($ctx);
     if (is_array($this->orderdetails)) {
         $params = array();
         $names = $this->getDB()->getResultsKV("id", "name", "SELECT `id`, `name` FROM `node` WHERE `id` " . sql::in(array_keys($this->orderdetails), $params), $params);
         $table = '';
         foreach ($this->orderdetails as $k => $v) {
             $name = isset($names[$k]) ? $names[$k] : '???';
             $row = html::em('td', html::em('a', array('href' => "admin/node/{$k}?destination=CURRENT"), html::plain($name)));
             $row .= html::em('td', html::cdata('× ' . $v));
             $table .= html::em('tr', $row);
         }
         if ($value = html::wrap('table', $table, array('class' => 'classic'))) {
             $xml .= html::em('field', array('title' => t('Содержимое заказа')), html::em('value', array('html' => true), html::cdata($value)));
         }
     }
     return $xml;
 }
コード例 #4
0
ファイル: node.type.php プロジェクト: umonkey/molinos-cms
 public function getPreviewXML(Context $ctx)
 {
     $result = parent::getPreviewXML($ctx);
     if (!$this->published) {
         $message = t('Документы этого (скрытого) типа не отображаются в обычном <a href="@url1">списке документов</a>, их не предлагают в стандартной <a href="@url2">форме создания документа</a>.', array('@url1' => 'admin/content/list', '@url2' => 'admin/create'));
         $result .= html::em('field', array('title' => t('Комментарий')), html::em('value', html::cdata($message)));
     }
     $count = Node::count(array('class' => $this->name, 'deleted' => 0), $ctx->db);
     if ($count) {
         $message = t('%count документов (<a href="@url">список</a>)', array('%count' => $count, '@url' => Node::create($this->name)->getListURL()));
         $result .= html::em('field', array('title' => t('Статистика')), html::em('value', html::cdata($message)));
     }
     return $result;
 }
コード例 #5
0
ファイル: node.file.php プロジェクト: umonkey/molinos-cms
 /**
  * Возвращает дополнительные поля для предварительного просмотра.
  */
 public function getPreviewXML(Context $ctx)
 {
     $result = parent::getPreviewXML($ctx);
     if ($this->width and $this->height) {
         $tmp = $this->width . '×' . $this->height;
         if ($this->filesize) {
             $tmp .= ', ' . mcms::filesize($this->filesize);
         }
         $result .= html::em('field', array('title' => t('Исходные размеры')), html::em('value', html::cdata($tmp)));
     }
     if ($this->duration) {
         $result .= html::em('field', array('title' => t('Продолжительность')), html::em('value', html::cdata($this->duration)));
     }
     if ($this->bitrate) {
         $result .= html::em('field', array('title' => t('Битрейт')), html::em('value', html::cdata(ceil($this->bitrate))));
     }
     if ($this->channels) {
         switch ($this->channels) {
             case 1:
                 $tmp = t('моно');
                 break;
             case 2:
                 $tmp = t('стерео');
                 break;
             case 4:
                 $tmp = t('квадро');
                 break;
             default:
                 $tmp = t('%count каналов', array('%count' => $this->channels));
         }
         $result .= html::em('field', array('title' => t('Звук')), html::em('value', array('channels' => $this->channels), html::cdata($tmp)));
     }
     if ($tmp = $this->getEmbedHTML($ctx)) {
         $result .= html::em('field', array('title' => t('Оригинал')), html::em('value', array('class' => 'embed'), html::cdata($tmp)));
     }
     if (!empty($this->versions)) {
         foreach ((array) $this->versions as $name => $info) {
             $em = array('title' => t('Версия %name', array('%name' => $name)));
             $url = os::webpath($ctx->config->getPath('modules/files/storage'), $info['filename']);
             $tmp = t('<a href="@url"><img src="@url" width="%width" height="%height" alt="%filename" /></a>', array('%name' => $name, '%width' => $info['width'], '%height' => $info['height'], '%filename' => basename($info['filename']), '@url' => $url));
             $tmp .= t('<br/>%width×%height', array('%width' => $info['width'], '%height' => $info['height']));
             $em['#text'] = html::em('value', html::cdata($tmp));
             $result .= html::em('field', $em);
         }
     }
     $count = Node::count(array('deleted' => 0, 'tagged' => $this->id), $ctx->db);
     if ($count) {
         $message = t('%count документов используют этот файл (<a href="@url">список</a>)', array('%count' => $count, '@url' => 'admin/content/list?search=tagged%3A' . $this->id));
         $result .= html::em('field', array('title' => t('Статистика')), html::em('value', html::cdata($message)));
     }
     return $result;
 }
コード例 #6
0
ファイル: node.user.php プロジェクト: umonkey/molinos-cms
 /**
  * Дополнительная информация для просмотра пользователя,
  * пока выводит только список групп.
  */
 public function getPreviewXML(Context $ctx)
 {
     return parent::getPreviewXML($ctx);
 }