Esempio n. 1
0
}
$yg_id = explode('-', $yg_id);
$obj_id = $yg_id[0];
$siteID = $yg_id[1];
$maxlevels = 5;
switch ($yg_type) {
    case 'pages':
        sUserMgr()->impersonate(sUserMgr()->getAdministratorID());
        $icons = new Icons();
        $pageMgr = new PageMgr($siteID);
        $page = $pageMgr->getPage($obj_id);
        if ($page) {
            $base = $page->get();
            $maxlevels = $base['LEVEL'] + 2;
            $objects = $pageMgr->getList($obj_id, array('SUBNODES'), $maxlevels, $roleid);
            $objects = $pageMgr->getAdditionalTreeInfo(false, $objects);
            foreach ($objects as $objectIndex => $object_item) {
                $iconData = getIconForPage($object_item);
                $objects[$objectIndex]['ICON'] = $iconData['iconclass'];
                $objects[$objectIndex]['STYLE'] = $iconData['style'];
                $objects[$objectIndex]['SITEID'] = $siteID;
            }
        }
        sUserMgr()->unimpersonate();
        break;
    case 'cblocks':
        sUserMgr()->impersonate(sUserMgr()->getAdministratorID());
        $cb = sCblockMgr()->getCblock($obj_id);
        if ($cb) {
            $base = $cb->get();
            $maxlevels = $base['LEVEL'] + 2;
Esempio n. 2
0
                 }
             }
         }
         $newPage->newVersion();
         $newPage->markAsChanged();
     }
 } else {
     // Recursive
     $oldpage = $source;
     $SourcePageMgr = new PageMgr($sourcesite);
     $sourcePage = $SourcePageMgr->getPage($source);
     $oldPageInfo = $sourcePage->get();
     $oldpagepid = $oldPageInfo["ID"];
     $TargetPageMgr = new PageMgr($targetsite);
     $copyjobs = $SourcePageMgr->getList($oldpage);
     $copyjobs = $SourcePageMgr->getAdditionalTreeInfo($SourcePageMgr, $copyjobs);
     $copystarted = false;
     $idmap = array();
     for ($i = 0; $i < count($copyjobs); $i++) {
         if ($copyjobs[$i]["ID"] == $oldpage) {
             if ($copystarted === false) {
                 $rootlevel = $copyjobs[$i]["LEVEL"];
                 $copystarted = true;
                 $newPageID = $TargetPageMgr->add($target);
                 if (!$newPageID) {
                     $permissionDenied = true;
                     break;
                 } else {
                     $newPage = $TargetPageMgr->getPage($newPageID);
                     $newPage->copyFrom($sourcePage);
                     $newPage->setActive(1);