Esempio n. 1
0
 public static function tree($options = array())
 {
     $current = $options['current'];
     if (!$current) {
         $current = ar::context()->getPath();
     }
     $top = $options['top'];
     if (!$top) {
         $top = ar_store::currentSite($current);
     }
     $options += array('siblings' => true, 'children' => true, 'current' => null, 'skipTop' => false, 'filter' => 'object.implements="pdir"', 'maxDepth' => 0);
     $query = "";
     if ($top[strlen($top) - 1] != '/') {
         $top = $top . '/';
     }
     if ($options['siblings'] && !$options['children']) {
         $current = dirname($current) . '/';
     } else {
         if (!$options['siblings'] && $options['children']) {
             $query .= "object.parent='" . $current . "' or ";
         }
     }
     while (substr($current, 0, strlen($top)) === $top && ar::exists($current)) {
         if ($options['siblings']) {
             $query .= "object.parent='{$current}' or ";
         } else {
             $query .= "object.path='{$current}' or ";
         }
         $current = dirname($current) . '/';
     }
     if (!$options['skipTop']) {
         $query .= "object.path='{$top}' or ";
     }
     if ($query) {
         $query = " and ( " . substr($query, 0, -4) . " )";
     }
     $maxDepth = (int) $options['maxDepth'];
     if ($maxDepth > 0) {
         $query .= " and object.path !~ '" . $top . str_repeat('%/', $maxDepth + 1) . "'";
     }
     if ($options['filter']) {
         $query .= ' and ( ' . $options['filter'] . ' )';
     }
     return ar::get($top)->find("object.priority>=0" . $query);
 }
Esempio n. 2
0
<pre>
<?php 
$ARCurrent->nolangcheck = true;
$ARCurrent->options["verbose"] = true;
$ARCurrent->AXAction == "import";
// become admin
$AR->user = new object();
$AR->user->data = new object();
$AR->user->data->login = $ARLogin = "******";
$ax_config["writeable"] = false;
$ax_config["database"] = "../packages/base.ax";
echo "ax file (" . $ax_config["database"] . ")\n";
$inst_store = $ax_config["dbms"] . "store";
$axstore = new $inst_store("", $ax_config);
// test if the base lib is available, die if not
if (!ar::exists('/system/lib/muze/cms/base/')) {
    echo "muze libs are not yet available, refusing upgrade\n";
    echo "Please manual import  /system/lib/muze/ from www/install/packages/base.ax and continue upgrade after that\n";
    die("could not complete upgrade");
}
function importTemplate($cpath, $args)
{
    global $store, $axstore;
    $templatesrc = current($axstore->call('system.get.template.php', $args, $axstore->get($cpath)));
    $templatedst = current($store->call('system.get.template.php', $args, $store->get($cpath)));
    if (!$store->exists($cpath)) {
        // cannot install config on non-existing path
        print "{$cpath} doesn't exists, skipping\n";
    }
    if (!ar_error::isError($templatesrc)) {
        if (ar_error::isError($templatedst)) {
Esempio n. 3
0
<?php

if ($this->data->path && ar::exists($this->data->path)) {
    ar::get($this->data->path)->call("explore.browse.php", $arCallArgs);
}
Esempio n. 4
0
if (!$order || !$orderqueries[$order]) {
    $orderQuery = "name.{$nls}.value {$direction}, name.none.value {$direction}";
} else {
    $orderQuery = [];
    foreach ($orderqueries[$order] as $orderpart) {
        $orderQuery[] = $orderpart . ' ' . $direction;
    }
    $orderQuery = implode(',', $orderQuery);
}
$offset = ($current_page - 1) * $items_per_page;
$colDefs = ['svn' => ['label' => $ARnls['svn'], 'sortable' => true], 'type' => ['label' => $ARnls['type'], 'sortable' => true], 'name' => ['label' => $ARnls['name'], 'sortable' => true], 'path' => ['label' => $ARnls['path'], 'sortable' => true], 'filename' => ['label' => $ARnls['filename'], 'sortable' => true], 'size' => ['label' => $ARnls['size'], 'sortable' => true, 'parser' => 'number'], 'owner' => ['label' => $ARnls['owner'], 'sortable' => true], 'modified' => ['label' => $ARnls['modified'], 'sortable' => true, 'formatterfunc' => 'muze.ariadne.explore.dateFormatter', 'parserfunc' => 'muze.ariadne.explore.dateParser'], 'language' => ['label' => $ARnls['language'], 'sortable' => true], 'priority' => ['label' => $ARnls['priority'], 'sortable' => true, 'parser' => 'number'], 'icons' => ['label' => '', 'sortable' => false, 'hide' => true], 'icon' => ['label' => '', 'sortable' => false, 'hide' => true]];
if (!$AR->SVN->enabled || !$this->CheckSilent('layout')) {
    // No SVN if SVN is not enabled;
    array_shift($colDefs);
}
$args = array("path" => $this instanceof \pshortcut && $this->data->path && ar::exists($this->data->path) ? $this->data->path : $this->path, "query" => '', "limit" => $items_per_page, "offset" => $offset, "sanity" => true, "order" => $orderQuery, "view" => $viewtype, "total" => ar::ls()->count(), "template" => 'system.list.entry.php', "args" => array("columns" => $colDefs), "filters" => array(), "method" => "post");
$args['parent'] = $args['path'];
$eventData = ar_events::fire('ariadne:onFilterGather', $args);
$eventData = ar_events::fire('ariadne:onFilter', $eventData);
if ($eventData) {
    $query = $eventData['query'];
    if ($eventData['parent'] && $query) {
        $query = sprintf('object.parent="%s" and ( %s )', $eventData['parent'], $query);
    } else {
        if (!$query) {
            $query = sprintf('object.parent="%s"', $eventData['parent'] ? $eventData['parent'] : $eventData['path']);
        }
    }
    $object_list = ar::get($eventData['path'])->find($query)->limit($eventData['limit'])->offset($eventData['offset'])->order($eventData['order'])->call($eventData['template'], $eventData['args']);
    $object_count = ar::get($eventData['path'])->find($query)->limit($eventData['limit'])->offset($eventData['offset'])->order($eventData['order'])->count();
    $divId = "resultsDiv";
Esempio n. 5
0
<?php

if ($scaffold && ar::exists($scaffold)) {
    $scaffoldOb = current(ar::get($scaffold)->call('system.get.phtml'));
    if ($scaffold) {
        // copy config from scaffold
        foreach ($scaffoldOb->data->config->pinp as $ttype => $tdata) {
            foreach ($tdata as $tfunction => $tlanguages) {
                foreach ($tlanguages as $tlanguage => $tid) {
                    if ($scaffoldOb->data->config->privatetemplates[$ttype][$tfunction]) {
                        $private = true;
                    } else {
                        $private = false;
                    }
                    if ($scaffoldOb->data->config->templates[$ttype][$tfunction][$tlanguage]) {
                        $default = true;
                    } else {
                        $default = false;
                    }
                    $template = $scaffoldOb->call('system.get.layout.phtml', array('type' => $ttype, 'function' => $tfunction, 'language' => $tlanguage));
                    $this->call('system.save.layout.phtml', array('type' => $ttype, 'function' => $tfunction, 'language' => $tlanguage, 'default' => $default, 'private' => $private, 'template' => $template));
                }
            }
        }
    }
    // copy all children from scaffold
    $objects = ar::get($scaffold)->find('')->limit(0)->order('object.path ASC')->call('system.get.name.phtml');
    foreach ($objects as $objectpath => $objectname) {
        $subpath = substr($objectpath, strlen($scaffold));
        ar::get($objectpath)->call('system.copyto.phtml', array('target' => $this->path . $subpath, 'search' => $scaffold, 'replace' => $this->path, 'defaultnls' => $this->data->nls->default));
    }