コード例 #1
0
ファイル: SelectFileController.php プロジェクト: saiber/www
 public function xmlBranch()
 {
     $rootID = $this->request->get("id");
     $xmlResponse = new XMLResponse();
     $xmlResponse->set("rootID", $rootID);
     $xmlResponse->set("tree", $this->getSubDirectories($rootID));
     return $xmlResponse;
 }
コード例 #2
0
ファイル: RssController.php プロジェクト: saiber/livecart
 public function news()
 {
     $this->shouldBeEnabledFeed('NEWS_POSTS');
     $this->setLayout('empty');
     $response = new XMLResponse();
     $f = select(eq(f('NewsPost.isEnabled'), true));
     $f->setLimit($this->config->get('NUMBER_OF_NEWS_POSTS_TO_INCLUDE'));
     $f->setOrder(f('NewsPost.position'), ARSelectFilter::ORDER_DESC);
     $response->set('feed', ActiveRecordModel::getRecordSetArray('NewsPost', $f));
     $this->application->getLocale()->translationManager()->loadFile('News');
     return $response;
 }
コード例 #3
0
ファイル: XmlController.php プロジェクト: saiber/livecart
 public function export()
 {
     $module = $this->request->get('module');
     $enabledFeeds = $this->config->get('ENABLED_FEEDS');
     if (!isset($enabledFeeds[$module]) || $this->request->get('key') != $this->config->get('FEED_KEY')) {
         return;
     }
     $this->setLayout('empty');
     set_time_limit(0);
     $cat = Category::getRootNode(true);
     $filter = new ProductFilter($cat, new ARSelectFilter());
     $filter->includeSubCategories();
     $feed = new ProductFeed($filter);
     $feed->setFlush();
     $response = new XMLResponse();
     $response->set('feed', $feed);
     $response->set('tpl', 'xml/feed/' . $module . '.tpl');
     return $response;
 }
コード例 #4
0
ファイル: lib.lime.php プロジェクト: AltaV/LightMeta
 function __construct($query)
 {
     parent::__construct();
     while ($type = $query->hash()) {
         $type_node = $this->attach("type");
         $type_node->appendChild($this->attach("id", $type['id']));
         $type_node->appendChild($this->attach("name", $type['type']));
         $type_node->appendChild($this->attach("label", $type['label']));
         $this->append($type_node);
     }
 }
コード例 #5
0
ファイル: xml_spec.php プロジェクト: ahmed555/Cupcake
<?php

describe("XML Response", function () {
    before(function () {
        $data = array("name" => "fernyb", "id" => "100", "location" => "California");
        $xml = new XMLResponse($data);
        return $xml;
    });
    it("returns xml", function ($xml) {
        $response = $xml->to_xml();
        $data = '<?xml version="1.0" encoding="UTF-8"?>
<name>fernyb</name><id>100</id><location>California</location>';
        assert_equal($data, $response);
    });
});
コード例 #6
0
 public function xmlRecursivePath()
 {
     $xmlResponse = new XMLResponse();
     $targetID = (int) $this->request->get("id");
     try {
         $categoriesList = Category::getInstanceByID($targetID)->getPathBranchesArray();
         if (count($categoriesList) > 0 && isset($categoriesList['children'][0]['parent'])) {
             $xmlResponse->set("rootID", $categoriesList['children'][0]['parent']);
             $xmlResponse->set("categoryList", $categoriesList);
         }
         $xmlResponse->set("doNotTouch", $this->request->get("doNotTouch"));
     } catch (Exception $e) {
     }
     $xmlResponse->set("targetID", $targetID);
     return $xmlResponse;
 }
コード例 #7
0
 protected function build()
 {
     $context = $this->getLime();
     $q = $this->query($context);
     $resp = new XMLResponse();
     $cnode = $resp->attach('context');
     $cnode->appendChild($resp->attach('type', $context->type));
     $cnode->appendChild($resp->attach('id', $context->id));
     $cnode->appendChild($resp->attach('name', $context->name));
     $resp->append($cnode);
     if ($q->select()) {
         $resp->status = "ok";
         while ($image = $q->hash()) {
             $node = $resp->attach('image');
             $meta = unserialize($image['meta']);
             $node->appendChild($resp->attach('id', $image['id']));
             NuEvent::filter("lime_image_xml", $node, $image);
             $node->appendChild($resp->attach('timestamp', $meta->gmts));
             $node->appendChild($resp->attach('utc', date('r', $meta->gmts)));
             $node->appendChild($resp->attach('uploader', $meta->user));
             $node->appendChild($resp->attach('method', $meta->method));
             if ($meta->method == 'url') {
                 $node->appendChild($resp->attach('source', $meta->source));
             }
             $node->appendChild($resp->attach('width', $meta->info[0]));
             $node->appendChild($resp->attach('height', $meta->info[1]));
             $resp->append($node);
         }
     }
     return $resp;
 }