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


PHP Node::set方法代码示例

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


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

示例1: testSet1

 public function testSet1()
 {
     $this->object->x = 37.5;
     $this->object->y = 45.33;
     $this->object->z = 0.26;
     $this->assertEquals('37.5 45.33 0.26', $this->object->set());
 }
开发者ID:vokson,项目名称:scad.local,代码行数:7,代码来源:NodeTest.php

示例2: testSaveField

 /**
  * testSaveField method
  *
  * @return void
  */
 public function testSaveField()
 {
     $this->loadFixtures('Article');
     $TestModel = new Article();
     $TestModel->id = 1;
     $result = $TestModel->saveField('title', 'New First Article');
     $this->assertFalse(empty($result));
     $TestModel->recursive = -1;
     $result = $TestModel->read(array('id', 'user_id', 'title', 'body'), 1);
     $expected = array('Article' => array('id' => '1', 'user_id' => '1', 'title' => 'New First Article', 'body' => 'First Article Body'));
     $this->assertEquals($expected, $result);
     $TestModel->id = 1;
     $result = $TestModel->saveField('title', '');
     $this->assertFalse(empty($result));
     $TestModel->recursive = -1;
     $result = $TestModel->read(array('id', 'user_id', 'title', 'body'), 1);
     $expected = array('Article' => array('id' => '1', 'user_id' => '1', 'title' => '', 'body' => 'First Article Body'));
     $result['Article']['title'] = trim($result['Article']['title']);
     $this->assertEquals($expected, $result);
     $TestModel->id = 1;
     $TestModel->set('body', 'Messed up data');
     $result = $TestModel->saveField('title', 'First Article');
     $this->assertFalse(empty($result));
     $result = $TestModel->read(array('id', 'user_id', 'title', 'body'), 1);
     $expected = array('Article' => array('id' => '1', 'user_id' => '1', 'title' => 'First Article', 'body' => 'First Article Body'));
     $this->assertEquals($expected, $result);
     $TestModel->recursive = -1;
     $TestModel->read(array('id', 'user_id', 'title', 'body'), 1);
     $TestModel->id = 1;
     $result = $TestModel->saveField('title', '', true);
     $this->assertFalse($result);
     $TestModel->recursive = -1;
     $TestModel->id = 1;
     $result = $TestModel->saveField('user_id', 9999);
     $this->assertTrue((bool) $result);
     $result = $TestModel->read(array('id', 'user_id'), 1);
     $expected = array('Article' => array('id' => '1', 'user_id' => '9999'));
     $this->assertEquals($expected, $result);
     $this->loadFixtures('Node', 'Dependency');
     $Node = new Node();
     $Node->set('id', 1);
     $result = $Node->read();
     $this->assertEquals(array('Second'), Hash::extract($result, 'ParentNode.{n}.name'));
     $Node->saveField('state', 10);
     $result = $Node->read();
     $this->assertEquals(array('Second'), Hash::extract($result, 'ParentNode.{n}.name'));
 }
开发者ID:manzapanza,项目名称:cakephp-api-utils,代码行数:52,代码来源:ModelWriteTest.php

示例3: node_controller

function node_controller()
{
    global $mysqli, $redis, $session, $route, $feed_settings, $user;
    $result = false;
    if (!isset($session['read'])) {
        return array('content' => $result);
    }
    include "Modules/feed/feed_model.php";
    $feed = new Feed($mysqli, $redis, $feed_settings);
    require "Modules/input/input_model.php";
    // 295
    $input = new Input($mysqli, $redis, $feed);
    require "Modules/input/process_model.php";
    // 886
    $process = new Process($mysqli, $input, $feed);
    $process->set_timezone_offset($user->get_timezone($session['userid']));
    include "Modules/node/node_model.php";
    $node = new Node($mysqli, $redis, $process);
    if ($route->format == 'html') {
        if ($route->action == "list" && $session['write']) {
            $result = view("Modules/node/node_view.php", array());
        }
        if ($route->action == "api" && $session['write']) {
            $result = view("Modules/node/node_api.php", array());
        }
    }
    if ($route->format == 'json') {
        if ($route->action == 'set' && $session['write']) {
            $data = explode(",", get('data'));
            for ($i = 0; $i < count($data); $i++) {
                $data[$i] = (int) $data[$i];
            }
            $result = $node->set($session['userid'], get('nodeid'), get('time'), $data);
        }
        if ($route->action == 'multiple' && $session['write']) {
            $data = json_decode(prop('data'));
            $len = count($data);
            if ($len > 0 && isset($data[$len - 1][0])) {
                // Sent at mode: input/bulk.json?data=[[45,16,1137],[50,17,1437,3164],[55,19,1412,3077]]&sentat=60
                if (isset($_GET['sentat'])) {
                    $time_ref = time() - (int) $_GET['sentat'];
                } elseif (isset($_POST['sentat'])) {
                    $time_ref = time() - (int) $_POST['sentat'];
                } elseif (isset($_GET['offset'])) {
                    $time_ref = time() - (int) $_GET['offset'];
                } elseif (isset($_POST['offset'])) {
                    $time_ref = time() - (int) $_POST['offset'];
                } elseif (isset($_GET['time'])) {
                    $time_ref = (int) $_GET['time'];
                } elseif (isset($_POST['time'])) {
                    $time_ref = (int) $_POST['time'];
                } else {
                    $time_ref = time() - (int) $data[$len - 1][0];
                }
                foreach ($data as $item) {
                    if (count($item) > 2) {
                        // check for correct time format
                        $itemtime = (int) $item[0];
                        $time = $time_ref + (int) $itemtime;
                        $nodeid = $item[1];
                        $bytevalues = array();
                        for ($i = 2; $i < count($item); $i++) {
                            $bytevalues[] = (int) $item[$i];
                        }
                        $result = $node->set($session['userid'], $nodeid, $time, $bytevalues);
                    }
                }
            }
        }
        if ($route->action == 'setdecoder' && $session['write']) {
            $result = $node->set_decoder($session['userid'], get('nodeid'), get('decoder'));
        }
        if ($route->action == 'getall' && $session['write']) {
            $result = $node->get_all($session['userid']);
        }
    }
    /*
    // Sent at mode: data= [[45,16,1137]] &sentat=60
        // Offset mode:  data= [[-10,16,1137]] &offset=-10
        // Time mode:    data= [[-10,16,1137]] &time=1387729425
        // Legacy mode:  data= [[0,16,1137]]
    // Sent at mode: data= [[45,16,1137],[50,17,1437,3164],[55,19,1412,3077]] &sentat=60
        // Offset mode:  data= [[-10,16,1137],[-8,17,1437,3164],[-6,19,1412,3077]] &offset=-10
        // Time mode:    data= [[-10,16,1137],[-8,17,1437,3164],[-6,19,1412,3077]] &time=1387729425
        // Legacy mode:  data= [[0,16,1137],[2,17,1437,3164],[4,19,1412,3077]]
    */
    return array('content' => $result);
}
开发者ID:barriquello,项目名称:simon,代码行数:88,代码来源:node_controller.php

示例4: copy

 public function copy($contents = true, $keepid = false)
 {
     $dom = new Gorilla3D\Dom(trim($this->toHtml()));
     $parnode = $dom->html->getElementsByTagName('body')->item(0);
     $chlnode = $parnode->childNodes->item(0);
     $i = 0;
     while ($chlnode instanceof DOMText) {
         $i++;
         $chlnode = $parnode->childNodes->item($i);
     }
     $domnode = new Node($dom, $chlnode);
     if (!$keepid) {
         $domnode->set('id', '');
     }
     if (!$contents) {
         $domnode->clear();
     }
     $domnode->mooid = uniqid();
     $domnode->setProperty('mooid', $domnode->mooid);
     return new Node($domnode->owner, $domnode->node);
 }
开发者ID:joseph-montanez,项目名称:PhpGtkChan,代码行数:21,代码来源:Node.php

示例5: create

 public function create()
 {
     if ($this->Node->exists()) {
         $this->AdminNodeForm->parent->value($this->Node->id);
         $this->data->set('pageTitle', __('Unterseite erstellen'));
     } else {
         $this->data->set('pageTitle', __('Seite erstellen'));
     }
     if ($this->AdminNodeForm->ok()) {
         $defaultLanguageId = ucfirst(substr(Registry::get('I18n.language'), 0, 2));
         $Node = new Node();
         $Node->set('name', $this->AdminNodeForm->headline->value());
         $Node->User = $this->UserLogin->User;
         $Node->Parent = new Node((int) $this->AdminNodeForm->parent->value());
         $Node->addFlag(NodeFlag::ALLOW_CHILDREN, NodeFlag::ALLOW_DELETE, NodeFlag::ALLOW_EDIT, NodeFlag::ALLOW_IMAGES);
         $this->AdminNodeForm->toModel($Node);
         $this->AdminNodeForm->toModel($Node->{'NodeText' . $defaultLanguageId});
         foreach ($this->Languages as $Language) {
             $Node->{'NodeText' . ucFirst($Language->id)}->User = $this->UserLogin->User;
         }
         if ($Node->saveAll()) {
             $this->FlashMessage->set(__('Die Seite wurde erfolgreich angelegt.'), FlashMessageType::SUCCESS);
             $this->redirect(Router::getRoute('adminNode'));
         }
         $this->AdminNodeForm->error = $Node->validationErrors;
     }
 }
开发者ID:Ephigenia,项目名称:harrison,代码行数:27,代码来源:AdminNodeController.php


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