/
Stack.php
36 lines (29 loc) · 1.14 KB
/
Stack.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
namespace Concrete\Core\Export\Item;
use Concrete\Core\Export\ExportableInterface;
defined('C5_EXECUTE') or die("Access Denied.");
class Stack implements ItemInterface
{
/**
* @param $stack \Concrete\Core\Page\Stack\Stack
* @param \SimpleXMLElement $xml
* @return mixed
*/
public function export($stack, \SimpleXMLElement $xml)
{
$db = \Database::connection();
$node = $xml->addChild('stack');
$node->addAttribute('name', \Core::make('helper/text')->entities($stack->getCollectionName()));
if ($stack->getStackTypeExportText()) {
$node->addAttribute('type', $stack->getStackTypeExportText());
}
$node->addAttribute('path', substr($stack->getCollectionPath(), strlen(STACKS_PAGE_PATH)));
// you shouldn't ever have a sub area in a stack but just in case.
$r = $db->Execute('select arHandle from Areas where cID = ? and arParentID = 0', array($stack->getCollectionID()));
while ($row = $r->FetchRow()) {
$ax = \Area::get($stack, $row['arHandle']);
$ax->export($node, $stack);
}
return $node;
}
}