Пример #1
0
 /**
  * Добавляет специфичные действия для типов документов.
  *
  * @mcms_message ru.molinos.cms.node.actions
  */
 public static function on_get_actions(Context $ctx, Node $node)
 {
     $result = array();
     if ($node->id and $node->checkPermission(ACL::CREATE)) {
         $result['clone'] = array('href' => "api/node/clone.rpc?id={$node->id}&destination=CURRENT", 'title' => t('Клонировать'));
     }
     return $result;
 }
Пример #2
0
 /**
  * Добавление действия ко всем документам.
  * @mcms_message ru.molinos.cms.node.actions
  */
 public static function on_get_actions(Context $ctx, Node $node)
 {
     if ($node instanceof FileNode or !$node->checkPermission(ACL::UPDATE)) {
         return;
     }
     $count = Node::count(array('class' => 'file', 'deleted' => 0, 'tags' => $node->id), $node->getDB());
     if ($count) {
         return array('attach' => array('href' => "admin/node/attach?id={$node->id}&destination=CURRENT", 'title' => t('Управление файлами'), 'scope' => 'edit'));
     } else {
         return array('attach' => array('href' => "admin/create/file?sendto={$node->id}&destination=CURRENT", 'title' => t('Добавить файлы'), 'scope' => 'edit'));
     }
 }
Пример #3
0
 /**
  * Добавляет информацию о разделах в предварительный просмотр.
  * @mcms_message ru.molinos.cms.hook.preview.xml
  */
 public static function on_preview_tags(Node $node)
 {
     if (!$node->checkPermission(ACL::UPDATE)) {
         return;
     }
     if ($data = $node->getDB()->getResultsKV("id", "name", "SELECT `id`, `name` FROM `node` WHERE `deleted` = 0 AND `class` = 'tag' AND `id` IN (SELECT `tid` FROM `node__rel` WHERE `nid` = ?)", array($node->id))) {
         $result = array();
         foreach ($data as $k => $v) {
             $result[] = html::em('a', array('href' => "admin/node/{$k}?destination=CURRENT"), html::plain($v));
         }
         $result = html::em('value', html::cdata(implode(', ', $result)));
         return html::em('field', array('html' => true, 'title' => t('Находится в разделах'), 'editurl' => "admin/structure/taxonomy/setup?node={$node->id}&destination=" . urlencode(MCMS_REQUEST_URI)), $result);
     }
 }
Пример #4
0
 /**
  * Ручное обновление XML через меню с действиями.
  * @mcms_message ru.molinos.cms.node.actions
  */
 public static function on_get_actions(Context $ctx, Node $node)
 {
     if ($node->checkPermission(ACL::UPDATE)) {
         return array('refresh' => array('href' => 'nodeapi/refresh?node=' . $node->id . '&destination=CURRENT', 'title' => 'Обновить XML', 'icon' => 'dump'));
     }
 }