当前位置: 首页>>代码示例>>PHP>>正文


PHP Node::find方法代码示例

本文整理汇总了PHP中Node::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Node::find方法的具体用法?PHP Node::find怎么用?PHP Node::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Node的用法示例。


在下文中一共展示了Node::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testFind

 public function testFind()
 {
     $tree = new Node();
     $node1 = new Node();
     $node2 = new Node();
     $tree->add($node1);
     $node1->add($node2);
     $this->assertNull($tree->find($node2->hashCode(), false));
     $this->assertEquals($node2, $tree->find($node2->hashCode()));
 }
开发者ID:jacobjjc,项目名称:PageKit-framework,代码行数:10,代码来源:NodeTest.php

示例2: taskRun

 /**
  * @mcms_message ru.molinos.cms.cron
  */
 public static function taskRun(Context $ctx)
 {
     $types = $ctx->config->get('modules/subscription/types', array());
     $xsl = $ctx->config->get('modules/subscription/stylesheet', os::path('lib', 'modules', 'subscription', 'message.xsl'));
     $sub = $ctx->config->get('modules/subscription/subject', 'Новости сайта %host');
     if (empty($types)) {
         return;
     }
     $ctx->db->beginTransaction();
     $users = Node::find(array('class' => 'subscription', 'deleted' => 0, 'published' => 1, '#sort' => 'name'), $ctx->db);
     // Обрабатываем активных пользователей.
     foreach ($users as $user) {
         $olast = $last = intval($user->last);
         if ($sections = (array) $user->tags) {
             list($sql, $params) = Query::build(array('class' => $types, 'tags' => $sections, 'published' => 1, 'deleted' => 0, 'id' => array('>' . ($olast + 1))))->getSelect(array('id', 'xml'));
             $nodes = $ctx->db->getResultsKV('id', 'xml', $sql, $params);
             // Отправляем документы.
             foreach ($nodes as $nid => $node) {
                 $xml = html::em('message', array('mode' => 'regular', 'unsubscribe' => 'subscription.rpc?action=remove&name=' . urlencode($user->name) . '&id=' . $user->id, 'base' => $ctx->url()->getBase($ctx), 'host' => MCMS_HOST_NAME), $node);
                 $body = xslt::transform($xml, $xsl, null);
                 $subject = t($sub, array('%host' => $ctx->url()->host()));
                 BebopMimeMail::send(null, $user->name, $subject, $body);
                 $last = max($last, $nid);
             }
             // Запоминаем последнее отправленное сообщение.
             $user->last = $last;
             $user->save();
         }
     }
     $ctx->db->commit();
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:34,代码来源:class.subscriptionscheduler.php

示例3: create

 public function create()
 {
     $node = Node::find(Input::get('node_id'));
     $nodes = Node::allLevelUp();
     //        return View::make('topics.create_edit', compact('nodes', 'node'));
     return View::make('topics.create_article', compact('nodes', 'node'));
 }
开发者ID:fcode520,项目名称:phphub,代码行数:7,代码来源:TopicsController.php

示例4: fire

 public function fire($job, $data)
 {
     $node = Node::find($data['message']['node_id']);
     $node->limbo = false;
     $node->save();
     return $job->delete();
 }
开发者ID:crudbug,项目名称:Dashboard,代码行数:7,代码来源:CancelDeployAgentToNode.php

示例5: on_get_settings

 /**
  * @mcms_message ru.molinos.cms.module.settings.drawtext
  */
 public static function on_get_settings(Context $ctx)
 {
     $fonts = array();
     foreach (Node::find(Context::last()->db, array('class' => 'file', 'filetype' => 'application/x-font-ttf')) as $n) {
         $fonts[$n->id] = isset($n->name) ? $n->name : $n->filename;
     }
     return new Schema(array('font' => array('type' => 'EnumControl', 'label' => t('Шрифт по умолчанию'), 'default' => t('(не использовать)'), 'options' => $fonts, 'description' => t('Вы можете <a href=\'@url\'>загрузить новый шрифт</a> в файловый архив.', array('@url' => '?q=admin/content/create&type=file&destination=CURRENT')))));
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:11,代码来源:class.drawtextmodule.php

示例6: rpc_purge

 public static function rpc_purge(Context $ctx)
 {
     $filter = array('class' => 'message', 're' => $ctx->user->id);
     $ids = join(', ', array_keys(Node::find($ctx->db, $filter)));
     if (!empty($ids)) {
         $ctx->db->exec("DELETE FROM `node` WHERE `id` IN ({$ids})");
         mcms::flush();
     }
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:9,代码来源:class.msgmodule.php

示例7: getGroups

 private static function getGroups()
 {
     $result = array();
     foreach (Node::find(array('class' => 'group')) as $g) {
         $result[$g->id] = $g->name;
     }
     asort($result);
     return $result;
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:9,代码来源:class.openidsettings.php

示例8: getList

 private function getList(Context $ctx)
 {
     $filter = array('class' => 'todo', '#sort' => 'created');
     if (!empty($this->options['rel'])) {
         $rel = $this->options['rel'];
         $filter['id'] = $ctx->db->getResultsV("id", "SELECT n.id AS `id` " . "FROM node n " . "WHERE n.class = 'todo' AND n.id IN " . "(SELECT tid FROM node__rel WHERE nid = ? " . "UNION SELECT nid FROM node__rel WHERE tid = ? " . "UNION SELECT rel FROM node__idx_todo WHERE rel = ?)", array($rel, $rel, $rel));
     }
     return Node::find($ctx->db, $filter);
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:9,代码来源:widget.todolist.php

示例9: getConfigOptions

 /**
  * Возвращает форму для настройки виджета.
  *
  * Добавляет к полученной от родиетля форме возможность выбрать базовый
  * виджет, с которым следует работать в паре.  Выбрать позволяют только один
  * из списков (ListWidget).
  *
  * @return Form вкладка формы, используется для настройки виджета.
  */
 public static function getConfigOptions(Context $ctx)
 {
     $widgets = array();
     foreach (Node::find(array('class' => 'widget'), $ctx->db) as $w) {
         if (!strcasecmp('ListWidget', $w->classname)) {
             $widgets[$w->name] = $w->title;
         }
     }
     return array('host' => array('type' => 'EnumControl', 'label' => t('Привязать к виджету'), 'description' => t('Выберите список документов, который будет параметризован этим виджетом.&nbsp; Ссылки, которые формирует навигатор по архиву, будут содержать параметры не для него самого, а для виджета, с которым он связан.'), 'options' => $widgets), 'reverse_years' => array('type' => 'BoolControl', 'label' => t('Список годов в обратном порядке')), 'reverse_months' => array('type' => 'BoolControl', 'label' => t('Список месяцев в обратном порядке')));
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:19,代码来源:widget.archive.php

示例10: onGet

 public function onGet(array $options)
 {
     $result = array('list' => array());
     $filter = array('class' => 'message', 're' => $options['uid'], 'deleted' => 0, '#sort' => '-id');
     foreach (Node::find($this->ctx->db, $filter, $options['limit']) as $n) {
         $result['list'][] = $n->getRaw();
     }
     $result['count'] = Node::count($filter);
     $result['left'] = $result['count'] - count($result['list']);
     return $result;
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:11,代码来源:widget.messagelist.php

示例11: on_get_groups

 public static function on_get_groups(Context $ctx)
 {
     $nodes = Node::find(array('class' => 'group', 'deleted' => 0), $ctx->db);
     $counts = $ctx->db->getResultsKV('id', 'count', "SELECT tid AS id, COUNT(*) AS count FROM node__rel r INNER JOIN node g ON g.id = r.tid INNER JOIN node u ON u.id = r.nid WHERE g.deleted = 0 AND u.deleted = 0 AND g.class = 'group' AND u.class = 'user' GROUP BY tid");
     $html = '';
     foreach ($nodes as $node) {
         $count = isset($counts[$node->id]) ? $counts[$node->id] : 0;
         $html .= html::em('node', array('id' => $node->id, 'name' => $node->getName(), 'created' => $node->created, 'users' => $count, 'editable' => $node->checkPermission(ACL::UPDATE), 'published' => true));
     }
     $html = html::wrap('data', $html);
     return html::em('content', array('name' => 'list', 'preset' => 'groups', 'title' => t('Группы пользователей'), 'nosearch' => true, 'create' => 'admin/create/group'), $html);
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:12,代码来源:class.authform.php

示例12: hookRemoteCall

 public static function hookRemoteCall(Context $ctx)
 {
     if (null !== $ctx->get('source') and null !== $ctx->get('search')) {
         $output = array();
         $parts = explode('.', $ctx->get('source'), 2);
         foreach (Node::find($ctx->db, $filter = array('class' => $parts[0], $parts[1] => '%' . $ctx->get('search') . '%'), 10) as $n) {
             $output[$n->id] = isset($n->{$parts}[1]) ? $n->{$parts}[1] : $n->name;
         }
         $output = join("\n", array_values($output));
         return new Response($output, 'text/plain');
     }
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:12,代码来源:class.autocompletemodule.php

示例13: getData

 protected function getData()
 {
     $data = Node::find(array('class' => 'type', 'deleted' => 0, '#sort' => '-published name'), $this->ctx->db);
     $counts = $this->ctx->db->getResultsKV("name", "count", "SELECT `class` AS `name`, COUNT(*) AS `count` FROM `node` WHERE `deleted` = 0 GROUP BY `class`");
     $nodes = '';
     foreach ($data as $node) {
         if ($node->isdictionary) {
             $attrs = array('id' => $node->id, 'name' => $node->name, 'title' => $node->title, 'list' => Node::create($node->name)->getListURL(), 'published' => (bool) $node->published);
             $attrs['count'] = array_key_exists($node->name, $counts) ? $counts[$node->name] : 0;
             $nodes .= html::em('node', $attrs);
         }
     }
     return html::wrap('data', $nodes);
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:14,代码来源:class.dictlist.php

示例14: set

 public function set($value, &$node)
 {
     $this->validate($value);
     if (null === ($email = $this->findEmail($node))) {
         throw new InvalidArgumentException(t('Не удалось подписать вас на новости: в профиле не обнаружен ни один почтовый адрес.'));
     }
     $s = Node::find(array('class' => 'subscription', 'name' => $email), $node->getDB());
     if (empty($s)) {
         $s = Node::create('subscription', array('name' => $email));
     } else {
         $s = array_shift($s);
     }
     $s->linkSetParents($value, 'tag', $this->enabled)->save();
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:14,代码来源:control.subscription.php

示例15: openIDAuthorize

 public static function openIDAuthorize($openid_mode, Context $ctx)
 {
     self::includeOpenID();
     $mode = $ctx->config->get('modules/openid/mode', 'open');
     if ('none' == $mode) {
         throw new RuntimeException(t('Поддержка OpenID отключена администратором.'));
     }
     if ('id_res' == $openid_mode) {
         $openid = null;
         foreach (array('openid1_claimed_id', 'openid_claimed_id', 'openid_identity') as $key) {
             if (!empty($_GET[$key])) {
                 $openid = $_GET[$key];
                 break;
             }
         }
         if (null === $openid) {
             throw new RuntimeException('OpenID провайдер не вернул идентификатор.');
         }
         $nodes = Node::find(array('class' => 'user', 'name' => $openid, 'deleted' => 0), $ctx->db);
         if (!count($nodes)) {
             if ('open' != $mode) {
                 throw new ForbiddenException(t('Извините, автоматическая регистрация пользователей через OpenID отключена.'));
             }
             $fieldmap = array('sreg_email' => 'email', 'sreg_fullname' => 'fullname', 'sreg_nickname' => 'nickname');
             $node = Node::create(array('class' => 'user', 'parent_id' => null, 'name' => $openid, 'published' => true));
             foreach ($fieldmap as $k => $v) {
                 if (!empty($_GET[$key = 'openid_' . $k])) {
                     $node->{$v} = $_GET[$key];
                 }
             }
             $node->setRegistered($ctx);
             $node->save();
         } else {
             $node = array_shift($nodes);
             if (!$node->published) {
                 throw new ForbiddenException(t('Ваш профиль заблокирован.'));
             }
         }
         return $node;
     } else {
         // Login canceled
         Logger::log('login cancelled ?!');
         $ctx->redirect("auth/logout.rpc");
     }
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:45,代码来源:class.openidmodule.php


注:本文中的Node::find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。