/**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('pages', function (Blueprint $table) {
         $table->increments('id');
         $table->string('slug');
         $table->boolean('hide')->default(false);
         $table->boolean('show_in_footer_navigation')->default(false);
         $table->boolean('show_in_main_navigation')->default(true);
         $table->timestamps();
         NestedSet::columns($table);
     });
     Schema::create('page_translations', function (Blueprint $table) {
         $table->increments('id');
         $table->integer('page_id')->unsigned();
         $table->string('title');
         $table->string('browser_title')->nullable();
         $table->mediumText('meta_description')->nullable();
         $table->mediumText('meta_keywords')->nullable();
         $table->mediumText('html_content')->nullable();
         $table->string('locale')->index();
         $table->timestamps();
         $table->unique(['page_id', 'locale'], 'page_trans_parent_loc_unique');
         $table->foreign('page_id', 'page_trans_foreign')->references('id')->on('pages')->onUpdate('cascade')->onDelete('cascade');
     });
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('categories', function (Blueprint $table) {
         $table->increments('id');
         $table->string('title', 75);
         $table->string('description', 255);
         NestedSet::columns($table);
     });
 }
 public function up()
 {
     Schema::create('categories', function (Blueprint $table) {
         $table->increments('id');
         $table->string('name');
         $table->text('description')->nullable();
         $table->string('slug');
         NestedSet::columns($table);
         $table->timestamps();
     });
     Schema::create('categories_relations', function (Blueprint $table) {
         $table->integer('category_id');
         $table->morphs('categorizable');
         $table->timestamps();
     });
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('categories', function (Blueprint $table) {
         $table->increments('id');
         $table->string('name');
         $table->string('alias')->nullable();
         $table->text('description')->nullable();
         $table->integer('order')->default(0);
         $table->integer('status')->default(1);
         $table->softDeletes();
         $table->timestamps();
         NestedSet::columns($table);
         if ($fields = Config::get('category.custom_fields')) {
             foreach ($fields as $key => $value) {
                 $table->{$value}($key);
             }
         }
     });
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('categories', function (Blueprint $table) {
         $table->increments('id');
         $table->string('title');
         //$table->integer('_lft')->index();
         //$table->integer('_rgt')->index();
         //$table->integer('parent_id')->index()->unsigned()->nullable();
         $table->string('slug');
         $table->integer('level');
         $table->string('path');
         $table->tinyInteger('is_link');
         $table->string('type')->index();
         $table->integer('hits');
         NestedSet::columns($table);
         // Performs all actions at the commented lines
         $table->timestamps();
     });
     NestedSet::createRoot('categories', array('title' => 'root'));
     // Schema::table('categories', function($table) {
     //  $table->foreign('parent_id')->references('id')->on('categories');
     // });
 }
Пример #6
0
 /**
  * deleteUnitNode
  * @author Thomas Schedler <*****@*****.**>
  * @param integer $intElementId
  * @version 1.0
  */
 public function deleteUnitNode($intUnitId)
 {
     $this->core->logger->debug('core->models->Contacts->deleteUnitNode(' . $intUnitId . ')');
     $this->getUnitTable();
     $objNestedSet = new NestedSet($this->objUnitTable);
     $objNestedSet->setDBFParent('idParentUnit');
     $objNestedSet->setDBFRoot('idRootUnit');
     $objNestedSet->deleteNode($intUnitId);
     //FIXME:: delete contacts?
 }
Пример #7
0
 public function testMoveAsLast()
 {
     // single root
     $array = NestedSet::model()->findAll();
     $nestedSet = NestedSet::model()->findByPk(3);
     $this->assertTrue($nestedSet instanceof NestedSet);
     $target = NestedSet::model()->findByPk(5);
     $this->assertTrue($target instanceof NestedSet);
     $this->assertTrue($nestedSet->moveAsLast($target));
     $this->assertTrue($this->checkTree());
     $this->assertTrue($this->checkArray($array));
     $nestedSet = NestedSet::model()->findByPk(2);
     $this->assertTrue($nestedSet instanceof NestedSet);
     $this->assertTrue($nestedSet->moveAsLast($target));
     $this->assertTrue($this->checkTree());
     $this->assertTrue($this->checkArray($array));
     // many roots
     $array = NestedSetWithManyRoots::model()->findAll();
     $nestedSet = NestedSetWithManyRoots::model()->findByPk(3);
     $this->assertTrue($nestedSet instanceof NestedSetWithManyRoots);
     $target = NestedSetWithManyRoots::model()->findByPk(5);
     $this->assertTrue($target instanceof NestedSetWithManyRoots);
     $this->assertTrue($nestedSet->moveAsLast($target));
     $this->assertTrue($this->checkTreeWithManyRoots());
     $this->assertTrue($this->checkArrayWithManyRoots($array));
     $nestedSet = NestedSetWithManyRoots::model()->findByPk(2);
     $this->assertTrue($nestedSet instanceof NestedSetWithManyRoots);
     $this->assertTrue($nestedSet->moveAsLast($target));
     $this->assertTrue($this->checkTreeWithManyRoots());
     $this->assertTrue($this->checkArrayWithManyRoots($array));
     $nestedSet = NestedSetWithManyRoots::model()->findByPk(3);
     $this->assertTrue($nestedSet instanceof NestedSetWithManyRoots);
     $target = NestedSetWithManyRoots::model()->findByPk(12);
     $this->assertTrue($target instanceof NestedSetWithManyRoots);
     $this->assertTrue($nestedSet->moveAsLast($target));
     $this->assertTrue($this->checkTreeWithManyRoots());
     $this->assertTrue($this->checkArrayWithManyRoots($array));
     $nestedSet = NestedSetWithManyRoots::model()->findByPk(2);
     $this->assertTrue($nestedSet instanceof NestedSetWithManyRoots);
     $this->assertTrue($nestedSet->moveAsLast($target));
     $this->assertTrue($this->checkTreeWithManyRoots());
     $this->assertTrue($this->checkArrayWithManyRoots($array));
 }
Пример #8
0
 /**
  * moveFolderToLastChildOfRootFolder
  * @author Thomas Schedler <*****@*****.**>
  * @param integer $intFolderId
  * @param integer $intRootFolderId
  * @version 1.0
  */
 public function moveFolderToLastChildOfRootFolder($intFolderId, $intRootFolderId)
 {
     $this->core->logger->debug('core->models->Folders->moveFolderToLastChildOfRootFolder(' . $intFolderId . ',' . $intRootFolderId . ')');
     $this->getFolderTable();
     $objNestedSet = new NestedSet($this->objFolderTable);
     $objNestedSet->setDBFParent('idParentFolder');
     $objNestedSet->setDBFRoot('idRootLevels');
     $objLastRootFolderData = $this->loadLastRootFolder($intRootFolderId);
     if (count($objLastRootFolderData) > 0) {
         $objLastRootFolder = $objLastRootFolderData->current();
         $objNestedSet->moveToNextSibling($intFolderId, $objLastRootFolder->id);
     }
 }
Пример #9
0
    /**
     * This function builds the content of the <code>body</code>.
     *
     * @access public
     * @author kalmer
     * @param string         $parameters['alias']          the alias
     * @param string[string] $parameters['breadcrumb']     the breadcrumb as
     * 		links and texts
     * @param boolean        $parameters['broad']          Do we show the broad
     * 		page?
     * @param string         $parameters['content']        the content to be
     * 		displayed on the page
     * @param boolean        $parameters['error']          Are we in the error
     * 		state?
     * @param boolean        $parameters['facebookOnline'] Is Facebook online?
     * @param string         $parameters['id']             the ID of the object
     * 		(optional)
     * @param string         $parameters['type']           the type of the
     * 		original object
     * @param integer        $parameters['idOfLanguage']   the ID of the
     * 		language
     * @param boolean        $parameters['intro']          Is it the intro page?
     * @param Page           $parameters['page']           the page
     * @param string         $parameters['suffix']         the suffix
     * @param Human|boolean  $parameters['user']           the current user or
     * 		<code>FALSE</code>
     * @param integer        $parameters['width']          the width
     * @uses ALBUMS                                 for link the widget for the
     * 		Facebook page
     * @uses DEFAULT_LANGUAGE                       for knowing the current
     * 		language
     * @uses DOMAIN                                 for addressing
     * @uses Language                               for translations
     * @uses MenuItem                               for menus
     * @uses NestedSet                              for menus
     * @uses NESTED_SET_MENU_FOR_INTRO              for the menu on the intro
     * 		page
     * @uses NESTED_SET_MENU_FOR_LOGGED_IN          for people logged in
     * @uses NESTED_SET_MENU_FOR_MAIN_ADMINISTRATOR for the administration menu
     * @uses NESTED_SET_MENU_FOR_REGISTERED_USER    for registered user
     * @uses NESTED_SET_MENU_MAIN_BUTTONS           for main buttons
     * @uses NESTED_SET_MENU_PUBLIC                 for the public menu
     * @uses NESTED_SET_MENU_WE                     for the menu about us
     * @uses O_FOLDER                               for the templates from "O"
     * @uses OFFLINE                                for displaying different
     * 		content for offline and online
     * @uses RequisitesView                         for requisites
     * @uses HumanView                              for log-in-form
     * @uses View                                   for error handling
     */
    public static function buildBody($parameters)
    {
        require_once O_FOLDER . 'errors/ErrorView.php';
        \PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array(new ErrorView(), 'raiseError'));
        require_once 'HTML/Template/IT.php';
        $tpl = new \HTML_Template_IT(sprintf('%1$s/../assets/tpl/%2$u', dirname(__FILE__), $parameters['width']));
        $tpl->loadTemplatefile('body.tpl');
        if (isset($parameters['broad']) || $parameters['width'] < 321) {
            $jsNormal = '';
        } else {
            $templateForJsNormal = new \HTML_Template_IT(sprintf('%1$s/../assets/tpl/%2$u', dirname(__FILE__), $parameters['width']));
            $templateForJsNormal->loadTemplatefile('body.tpl');
            if (!OFFLINE && isset($parameters['facebookOnline'])) {
                $templateForJsNormal->setCurrentBlock('facebook-albums');
                $templateForJsNormal->setVariable(array('SUBFOLDER-FOR-ALBUMS' => ALBUMS));
                $templateForJsNormal->parseCurrentBlock();
            }
            $templateForJsNormal->setCurrentBlock('js-normal');
            $templateForJsNormal->setVariable(array('BEGINNING-OF-URL-IN-JS-NORMAL' => DOMAIN));
            $templateForJsNormal->parseCurrentBlock();
            $jsNormal = $templateForJsNormal->get('js-normal');
        }
        $templateForScripts = new \HTML_Template_IT(O_FOLDER . 'assets/tpl');
        $templateForScripts->loadTemplatefile('page_Kai.tpl');
        $templateForScripts->setCurrentBlock('scripts');
        $templateForScripts->setVariable(array('JS-NORMAL' => $jsNormal));
        $templateForScripts->parse('scripts');
        $isError = isset($parameters['isError']) && $parameters['isError'];
        if (isset($parameters['user']) && is_object($parameters['user']) && !$isError) {
            if (isset($parameters['breadcrumb'])) {
                foreach ($parameters['breadcrumb'] as $link => $val) {
                    $tpl->setCurrentBlock('position');
                    $tpl->setVariable(array('LINK-TO-POSITION' => $link, 'STEP' => end($parameters['breadcrumb
						']) === $val ? 'active' : 'completed', 'VALUE-OF-POSITION' => str_replace(' ', '&#160;', $val)));
                    $tpl->parseCurrentBlock();
                }
            } else {
                if (isset($_SESSION['nestedSets'])) {
                    require_once O_FOLDER . 'puu/NestedSet.php';
                    $nestedSets = explode(',', $_SESSION['nestedSets']);
                    $idOfNestedSet = $nestedSets[count($nestedSets) - 1];
                    $nestedSetForPosition = new NestedSet();
                    $nestedSetForPosition->setId($idOfNestedSet);
                    $nestedSetForPosition->setCompleteNestedSet();
                    $descendantNestedSets = $nestedSetForPosition->getDescendantNestedSets();
                    if (isset($descendantNestedSets[$idOfNestedSet])) {
                        foreach ($descendantNestedSets[$idOfNestedSet]->path as $idNestedSet => $txt) {
                            $elInPath = new NestedSet($idNestedSet);
                            $descendantNestedSetsOfElementInPath = $elInPath->getDescendantNestedSets();
                            if (isset($descendantNestedSetsOfElementInPath[$idNestedSet]->idEl)) {
                                require_once dirname(__FILE__) . '/../puu/SystemMenuItem.php';
                                $menuEl = new SystemMenuItem();
                                $menuEl->setId($descendantNestedSetsOfElementInPath[$idNestedSet]->idEl);
                                $menuEl->setCompleteSystemMenuItem();
                                if (isset($menuEl->page)) {
                                    $href = '?function=loadPage&amp;page=' . $menuEl->page->getId();
                                    $caption = $menuEl->page->title;
                                } else {
                                    $href = strtr($menuEl->ref, '&', '&amp;');
                                    $caption = $menuEl->title;
                                    if (strstr($menuEl->ref, '[ID-OF-USER]') > -1) {
                                        if (isset($_SESSION['User_ID'])) {
                                            $href = str_replace('[ID-OF-USER]', '&amp;idHuman=' . $_SESSION['idUser'], $menuEl->ref);
                                        }
                                    }
                                    if (strstr($menuEl->ref, '[ID-OF-COMPANY]') > -1) {
                                        if (isset($_SESSION['idCompany'])) {
                                            $href = str_replace('[ID-OF-COMPANY]', '&amp;idContact=' . $_SESSION['idCompany'], $menuEl->ref);
                                        }
                                    }
                                }
                                $tpl->setCurrentBlock('position');
                                $tpl->setVariable(array('BEGINNING-OF-URL' => DOMAIN, 'LINK-TO-POSITION' => isset($href) ? $href : '#', 'STEP' => end($descendantNestedSets[$idOfNestedSet]->path) === $txt ? 'active' : 'completed', 'VALUE-OF-POSITION' => str_replace(' ', '&#160;', $caption)));
                                $tpl->parseCurrentBlock();
                            }
                        }
                    }
                }
            }
        }
        $menus = array();
        require_once O_FOLDER . 'puu/SystemMenuItemView.php';
        if ($isError) {
            $buildMenuOfLanguages = FALSE;
        } else {
            $buildMenuOfLanguages = TRUE;
            if (isset($parameters['user']) && is_object($parameters['user'])) {
                require_once O_FOLDER . 'puu/SystemMenuItemView.php';
                if ($parameters['user']->isMainAdministrator()) {
                    $isMainAdministrator = TRUE;
                    $menus['forMainAdministrator'] = SystemMenuItemView::buildMenu(array('alias' => $parameters['alias'], 'block' => '2', 'root' => NESTED_SET_MENU_FOR_MAIN_ADMINISTRATOR, 'suffix' => $parameters['suffix'], 'user' => $parameters['user'], 'width' => $parameters['width']));
                    $menus['loggedIn'] = SystemMenuItemView::buildMenuForLoggedIn(array('alias' => $parameters['alias'], 'user' => $parameters['user'], 'width' => $parameters['width']));
                    $menus['forRegisteredUser'] = SystemMenuItemView::buildMenu(array('alias' => $parameters['alias'], 'block' => 'open', 'root' => NESTED_SET_MENU_FOR_REGISTERED_USER, 'suffix' => $parameters['suffix'], 'user' => $parameters['user'], 'width' => $parameters['width']));
                } else {
                    $isMainAdministrator = FALSE;
                    $menus['loggedIn'] = SystemMenuItemView::buildMenuForLoggedIn(array('alias' => $parameters['alias'], 'user' => $parameters['user'], 'width' => $parameters['width']));
                    $menus['forRegisteredUser'] = SystemMenuItemView::buildMenu(array('alias' => $parameters['alias'], 'block' => 'open', 'root' => NESTED_SET_MENU_FOR_REGISTERED_USER, 'suffix' => $parameters['suffix'], 'user' => $parameters['user'], 'width' => $parameters['width']));
                }
            } else {
                $isMainAdministrator = FALSE;
            }
            // echo ' 679: <pre>';print_r(debug_print_backtrace()); echo '</pre>';
            $idOfObject = $parameters['page']->getId();
            if ($parameters['page']->getTypeOfObject() === 'Page' && ID_OF_OPENING_PAGE != $idOfObject || $parameters['page']->getTypeOfObject() != 'Page' || $isMainAdministrator) {
                $menus['aboutUs'] = SystemMenuItemView::buildMenu(array('alias' => $parameters['alias'], 'block' => 'we', 'root' => NESTED_SET_MENU_WE, 'suffix' => $parameters['suffix'], 'user' => $parameters['user'], 'width' => $parameters['width']));
            }
        }
        $menus['public'] = SystemMenuItemView::buildMenu(array('alias' => $parameters['alias'], 'block' => '1', 'root' => NESTED_SET_MENU_PUBLIC, 'suffix' => $parameters['suffix'], 'user' => $parameters['user'], 'width' => $parameters['width']));
        if ($parameters['page']->getTypeOfObject() === 'Page' && ID_OF_OPENING_PAGE == $idOfObject) {
            $menus['forIntro'] = SystemMenuItemView::buildMenu(array('alias' => $parameters['alias'], 'block' => 'intro', 'root' => NESTED_SET_MENU_FOR_INTRO, 'suffix' => $parameters['suffix'], 'user' => $parameters['user'], 'width' => $parameters['width']));
        }
        $outerNews = array();
        if ($parameters['width'] > 899 && !$isError && !OFFLINE) {
            require_once O_FOLDER . 'magpierss-0.72/rss_fetch.inc';
            $rss = fetch_rss(RSS_FEED);
            if (is_object($rss)) {
                $firstOuterNewsItems = array_slice($rss->items, 0, 1);
                $secondOuterNewsItems = array_slice($rss->items, 1, 1);
                $remainingOuterNewsItems = array_slice($rss->items, 2, 1);
                if ($parameters['width'] > 1301 && $parameters['width'] < 1800) {
                    $additionalClassForOuterNews = 'CaptionInEdge';
                } else {
                    $additionalClassForOuterNews = 'CaptionInWideColumn';
                }
                $outerNews['first'] = BodyView::buildOuterNews(array('class' => $additionalClassForOuterNews, 'outerNewsItem' => $firstOuterNewsItems[0], 'width' => $parameters['width']));
                $outerNews['second'] = BodyView::buildOuterNews(array('class' => $additionalClassForOuterNews, 'outerNewsItem' => $secondOuterNewsItems[0], 'width' => $parameters['width']));
                $outerNews['remaining'] = '';
                foreach ($remainingOuterNewsItems as $remainingItem) {
                    $outerNews['remaining'] .= BodyView::buildOuterNews(array('class' => $additionalClassForOuterNews, 'outerNewsItem' => $remainingItem, 'width' => $parameters['width']));
                }
            }
        }
        if (!OFFLINE && !$isError) {
            require_once O_FOLDER . 'varud/Inquiry.php';
            $inquiry = new \o\Inquiry();
            $currentSupporterLogos = '';
            if (isset($_GET['idEvent']) || isset($_GET['iDOCompetition'])) {
                if (isset($_GET['idEvent'])) {
                    require_once dirname(__FILE__) . '/../o/turniirid/Incident.php';
                    $event = new \o\Incident($_GET['idEvent']);
                } else {
                    $competition = new \o\Competition($_GET['iDOCompetition']);
                    $event = $competition->event;
                }
                foreach ($inquiry->categories as $cat) {
                    $supporterLogos = $event->getLogos($cat['id']);
                    if (sizeOf($supporterLogos) > 0) {
                        $currentSupporterLogos .= BodyView::buildLogos(array('folder' => '/assets/tpl', 'file' => 'page_Kai', 'logos' => $supporterLogos, 'block' => 'current', 'category' => $cat, 'sizes' => array('width' => 132, 'height' => 120), 'widthOfBlock' => 132));
                    }
                }
            } else {
                if ($parameters['width'] > 320) {
                    foreach ($inquiry->categories as $cat) {
                        require_once O_FOLDER . 'turniirid/Incident.php';
                        $supporterLogos = Incident::getActualLogos($cat['id']);
                        if (sizeOf($supporterLogos) > 0) {
                            $currentSupporterLogos .= BodyView::buildLogos(array('folder' => '/assets/tpl', 'file' => 'page_Kai', 'logos' => $supporterLogos, 'block' => 'current', 'category' => $cat, 'sizes' => array('width' => $parameters['width'] > 1301 ? 200 : 122, 'height' => 244), 'widthOfBlock' => $parameters['width'] > 1800 ? 200 : 122));
                        }
                    }
                }
            }
        }
        $menus['mainButtons'] = SystemMenuItemView::buildMenu(array('block' => 'mainButtons', 'root' => NESTED_SET_MENU_MAIN_BUTTONS, 'suffix' => $parameters['suffix'], 'user' => $parameters['user'], 'width' => $parameters['width']));
        $login = '';
        require_once O_FOLDER . 'View.php';
        if (!$isError) {
            require_once O_FOLDER . 'haldus/kasutajad/HumanView.php';
            if (isset($parameters['user']) && is_object($parameters['user']) && $parameters['user']->isLoggedIn(array($parameters['suffix']))) {
                $contentOfLogin = HumanView::buildLoggedIn(array('suffix' => $parameters['suffix'], 'width' => $parameters['width']));
            } else {
                $contentOfLogin = \o\HumanView::buildButtonForLoginForm(array('isDraggable' => FALSE, 'width' => $parameters['width']));
                // 				$login .= HumanView::buildLoginForm(array (
                // 					'functions'               => array (),
                // 					'idOfFieldOfInfo'         => 'messageForLoggingIn',
                // 					'idOfFieldOfInfoOriginal' => '',
                // 					'idOfTarget'              => 'wrapperForLoggingIn',
                // 					'suffix'                  => $parameters['suffix'],
                // 					'width'                   => $parameters['width']
                // 				));
            }
            // echo ' 760: ', $contentOfLogin;
            $login = \o\View::buildTarget(array('buildNavigation' => FALSE, 'content' => $contentOfLogin, 'highSlidable' => FALSE, 'id' => '', 'type' => 'ButtonsOfLogin', 'insertionAddition' => '', 'width' => $parameters['width']));
        }
        // echo ' 772: ', $login;
        if (isset($parameters['broad']) && $parameters['broad']) {
            // 			echo ' 763: ', $parameters['content'];
            $contentOfSite = BodyView::buildBig(array('content' => $parameters['content'], 'width' => $parameters['width']));
        } else {
            $contentOfSite = BodyView::buildNormal(array('content' => $parameters['content'], 'currentSupporterLogos' => $isError ? NULL : $currentSupporterLogos, 'user' => $parameters['user'], 'id' => isset($parameters['id']) ? $parameters['id'] : NULL, 'type' => isset($parameters['type']) ? $parameters['type'] : NULL, 'idOfLanguage' => $parameters['idOfLanguage'], 'login' => $login, 'menus' => $menus, 'outerNews' => $outerNews, 'page' => $parameters['page'], 'rss' => isset($rss) ? $rss : NULL, 'suffix' => $parameters['suffix'], 'width' => $parameters['width']));
        }
        // echo ' 783: ', $contentOfSite;
        if (isset($_SESSION['nestedSets']) && !$isError) {
            $nestedSets = array_reverse(array_slice(explode(',', $_SESSION['nestedSets']), 3));
            foreach ($nestedSets as $nestedSet) {
                require_once O_FOLDER . 'puu/SystemMenuItemView.php';
                $submenu = SystemMenuItemView::buildMenu(array('alias' => $parameters['alias'], 'block' => 'submenu', 'root' => $nestedSet, 'secondLevel' => TRUE, 'suffix' => $parameters['suffix'], 'user' => $parameters['user'], 'width' => $parameters['width']));
                if ($submenu != '') {
                    break;
                }
            }
        }
        if ($parameters['width'] > 1301 && $parameters['width'] < 1800 && !$isError && !isset($parameters['intro'])) {
            $bestPlayers = BodyView::buildBestPlayers(array('suffix' => $parameters['suffix'], 'width' => $parameters['width']));
        } else {
            $bestPlayers = '';
        }
        // echo ' 974: ', FB_BADGE;
        require_once O_FOLDER . 'rekvisiidid/RequisitesView.php';
        // echo ' 833: ', BodyView::buildLanguageMenu(
        // 				array (
        // 					'id'     => isset($parameters['id']) ?
        // 							$parameters['id']: NULL,
        // 					'type'   => $parameters['type'],
        // 					'suffix' => $parameters['suffix'],
        // 					'width'  => $parameters['width']
        // 				)
        // 			);
        // echo ' 855: ', $login;
        $tpl->setCurrentBlock('body');
        $tpl->setVariable(array('BADGE' => FB_BADGE, 'USERNAME-IN-FACEBOOK' => ALBUMS, 'BEST-PLAYERS-IN-BODY' => $bestPlayers, 'CONTENT-OF-SITE' => $contentOfSite, 'CURRENT-SUPPORTER-LOGOS' => isset($currentSupporterLogos) ? $currentSupporterLogos : '', 'HUMAN' => \o\View::buildTarget(array('buildNavigation' => TRUE, 'highSlidable' => TRUE, 'id' => '', 'insertionAddition' => '', 'type' => 'user', 'width' => $parameters['width'])), 'LANGUAGES' => isset($parameters['type']) && $buildMenuOfLanguages ? BodyView::buildLanguageMenu(array('id' => isset($parameters['id']) ? $parameters['id'] : NULL, 'type' => $parameters['type'], 'suffix' => $parameters['suffix'], 'width' => $parameters['width'])) : '', 'LOCATION' => DOMAIN, 'LOGGED-IN' => $login, 'LOGIN' => \o\View::buildTarget(array('buildNavigation' => TRUE, 'highSlidable' => TRUE, 'id' => '', 'idOfDiv' => 'Login', 'insertionAddition' => '', 'type' => 'Login', 'width' => $parameters['width'])), 'MENU-WITH-PRIORITY-LOGGED-IN' => isset($menus['loggedIn']) ? $menus['loggedIn'] : '', 'MENU-WITH-PRIORITY-PUBLIC' => isset($menus['public']) ? $menus['public'] : '', 'REQUISITES' => RequisitesView::buildRequisites(array('user' => $parameters['user'], 'width' => $parameters['width'])), 'SCRIPTS' => $templateForScripts->get('scripts'), 'SUBMENU' => isset($submenu) ? $submenu : ''));
        $tpl->parseCurrentBlock();
        // 		echo ' 866: ', $contentOfSite;
        return $tpl->get('body');
    }
Пример #10
0
     }
     break;
 case 'create':
     if (!$input[1]) {
         echo "Error: no collection specified.\n";
         break;
     }
     array_shift($input);
     $collection = array_shift($input);
     $_fields = array('id');
     $fields = array();
     foreach ($input as $field) {
         $fields[$field] = 'char(32)';
         $_fields[] = $field;
     }
     $ns = new NestedSet($collection);
     $res = $ns->create($fields);
     if (!$res) {
         echo 'Error: ' . $ns->error . "\n";
         break;
     }
     echo "Collection created.\n";
     break;
 case 'drop':
     if (!$collection) {
         echo "Error: no collection in use.\n";
         break;
     }
     echo "Are you sure you want to drop the collection '" . $collection . "'? (yes|no)\n";
     $in = explode(' ', trim(fgets(STDIN)));
     if ($in[0] != 'yes') {
Пример #11
0
 /**
  * deleteCategoryNode
  * @author Thomas Schedler <*****@*****.**>
  * @param integer $intElementId
  * @version 1.0
  */
 public function deleteCategoryNode($intCategoryId)
 {
     $this->core->logger->debug('core->models->Categories->deleteCategoryNode(' . $intCategoryId . ')');
     $this->getCategoriesTable();
     $objNestedSet = new NestedSet($this->objCategoriesTable);
     $objNestedSet->setDBFParent('idParentCategory');
     $objNestedSet->setDBFRoot('idRootCategory');
     $objNestedSet->deleteNode($intCategoryId);
 }
Пример #12
0
<?php

include '../pdo.nestedset.php';
$treeModel = new NestedSet(new PDO('mysql:host=localhost;dbname=tree', 'tree', 'tree'));
if (isset($_POST['action'])) {
    switch ($_POST['action']) {
        case 'create_node':
            echo $treeModel->addNode('new_node');
            break;
        case 'select_all':
            echo json_encode($treeModel->selectAll()->result());
            break;
        case 'move_node':
            $node_data = json_decode($_POST['node_data']);
            //move the new node after the prev one
            if ($node_data->prev != 'undefined') {
                $treeModel->addAfter($node_data->new, $node_data->prev);
            } else {
                if ($node_data->next != 'undefined') {
                    $treeModel->addBefore($node_data->new, $node_data->next);
                } else {
                    if ($node_data->parent != 'undefined') {
                        $treeModel->addChild($node_data->new, $node_data->parent);
                    }
                }
            }
            break;
        case 'remove_node':
            if (isset($_POST['id'])) {
                $treeModel->deleteNode($_POST['id']);
            }