コード例 #1
1
ファイル: Menu.php プロジェクト: nwidart/laravel-menus
 /**
  * Create new menu.
  *
  * @param string   $name
  * @param Callable $resolver
  *
  * @return \Nwidart\Menus\MenuBuilder
  */
 public function create($name, Closure $resolver)
 {
     $builder = new MenuBuilder($name, $this->config);
     $builder->setViewFactory($this->views);
     $this->menus[$name] = $builder;
     return $resolver($builder);
 }
コード例 #2
0
 /**
  * Get children of current menu item
  *
  * @return MenuItem[]
  */
 public function getChildren()
 {
     if (is_null($this->children)) {
         $this->children = $this->menu->getChildren($this);
     }
     return $this->children;
 }
コード例 #3
0
ファイル: site.php プロジェクト: aspnmy/weizan
 public function doMobileCenter()
 {
     global $_W, $_GPC;
     if (empty($_GPC['openid'])) {
         $from_user = $_W['fans']['from_user'];
     } else {
         $from_user = $_GPC['openid'];
     }
     $this->tryLink();
     yload()->classs('quick_center', 'fans');
     $_fans = new Fans();
     $fans = $_fans->refresh($_W['weid'], $from_user);
     $uplevelfans = $_fans->getUplevelFans($_W['weid'], $from_user);
     $groupid = empty($_GPC['groupid']) ? 1 : intval($_GPC['groupid']);
     $list = pdo_fetchall("SELECT * FROM " . tablename(self::$t_bind) . " WHERE weid=:weid AND enable=1 ORDER BY groupid, displayorder", array(':weid' => $_W['weid']));
     $list = $this->buildCallbackParam($list);
     yload()->classs('quick_center', 'menubuilder');
     $menus = MenuBuilder::build($list);
     $title = empty($this->module['config']['title']) ? $_W['account']['name'] : $this->module['config']['title'];
     $share = array();
     $share['disable'] = true;
     $vip_kv = unserialize($this->module['config']['vip']);
     $fans['vipname'] = $vip_kv[$fans['vip']];
     yload()->classs('quick_center', 'template');
     $_template = new Template($this->module['name']);
     $_W['account']['template'] = $this->getTemplateName();
     include $_template->template('center');
 }
コード例 #4
0
 public static function generate_from_pages($folders)
 {
     $sitemap = new Sitemap();
     foreach ($folders as $folder) {
         $menu_entries = MenuBuilder::get_menu_entries($folder);
         self::add_menu_entry($sitemap, $menu_entries);
     }
     return $sitemap;
 }
コード例 #5
0
ファイル: Page.php プロジェクト: JHDeStip/Stippers
 /**
  * Shows a page with the views that have been previously given.
  * Views will be displayed in the order they were added.
  */
 public function showWithMenu()
 {
     MenuBuilder::buildMenu($this);
     array_unshift($this->views, 'menu/MenuBarView');
     require_once __DIR__ . '/../views/common/Header.html';
     foreach ($this->views as $view) {
         require_once __DIR__ . '/../views/' . $view . '.html';
     }
     require_once __DIR__ . '/../views/common/Footer.html';
 }
コード例 #6
0
ファイル: MenuBuilder.class.php プロジェクト: mbcraft/frozen
 private static function loadSortedMenuData($folder)
 {
     $menu_files = $folder->findFilesEndingWith("menu.ini");
     if (count($menu_files) == 0) {
         return null;
     }
     $file = new File($folder->getPath() . $menu_files[0]->getFilename());
     $all_data = PropertiesUtils::readFromFile($file, true);
     $final_sorted_data = array();
     foreach ($all_data as $section => $data) {
         $data["key"] = $section;
         if (isset($data["folder"])) {
             $childs = MenuBuilder::loadSortedMenuData(new Dir($data["folder"]));
             if ($childs !== null) {
                 $data["childs"] = $childs;
             }
         }
         $final_sorted_data[(int) $data["position"]] = $data;
     }
     ArrayUtils::reorder_from_zero($final_sorted_data);
     return $final_sorted_data;
 }
コード例 #7
0
<?php

/**
 * Build out menu, flush DB at first
 */
$core_path = $modx->getOption('menubuilder.core_path', null, $modx->getOption('core_path') . 'components/menubuilder/');
require_once $core_path . 'model/menubuilder/MenuBuilder.php';
$placeholder = $modx->getOption('placeholder', $scriptProperties, null);
$menuBuilder = new MenuBuilder($modx);
if ((bool) $modx->getOption('debug', $scriptProperties, false)) {
    $menuBuilder->setDebug();
}
$branch_parents = $modx->getParentIds($modx->resource->get('id'));
// @TODO set via context_key:
$site_start = (int) $modx->getOption('site_start', null, 1);
/**
 * Now get user options:
 */
$menuBuilder->setOption('startId', (int) $modx->getOption('startId', $scriptProperties, 0))->setOption('displayStart', (bool) $modx->getOption('displayStart', $scriptProperties, false))->setOption('resourceColumns', $modx->getOption('', $scriptProperties, null))->setOption('viewHidden', (bool) $modx->getOption('viewHidden', $scriptProperties, false))->setOption('viewUnpublished', (bool) $modx->getOption('viewUnpublished', $scriptProperties, false))->setOption('viewDeleted', (bool) $modx->getOption('viewDeleted', $scriptProperties, false))->setOption('templates', $modx->getOption('templates', $scriptProperties, null))->setOption('contexts', $modx->getOption('contexts', $scriptProperties, $modx->context->key))->setOption('limit', $modx->getOption('limit', $scriptProperties, 0))->setOption('offset', $modx->getOption('offset', $scriptProperties, 0))->setOption('scheme', $modx->getOption('scheme', $scriptProperties, $modx->getOption('link_tag_scheme')))->setOption('where', $modx->getOption('where', $scriptProperties, null))->setOption('debugSql', (bool) $modx->getOption('debugSql', $scriptProperties, false))->setOption('rawTvs', $modx->getOption('rawTvs', $scriptProperties, ''))->setOption('processTvs', $modx->getOption('processTvs', $scriptProperties, ''))->setOption('limitLevelItems', $modx->getOption('limitLevelItems', $scriptProperties, ''))->setIteratorType($modx->getOption('iterateType', $scriptProperties, 'getIterator'))->setOption('activeResource', $modx->resource->get('id'))->setOption('siteStart', $site_start)->setOption('branchParents', $branch_parents);
/**
* TODO
   includeDocs
   excludeDocs
   limitDepthItems
   sortBy
   TVs
*  Selected columns
*/
/**
 * Now set what chunks will be used:
 */
コード例 #8
0
/*
 * blMenuAdministration.php
 *
 * The menu administration block for the web site.
 *
 * Written by: Bruno Schifer Bernardi
 * Last Updated: July 31, 2007
 */
?>

		<table width="100%" cellspacing="1" bgcolor="#000080">
			<tr>
				<td bgcolor="#DDDDDD" align="center" width="100%">

<?php 
$menu_builder = new MenuBuilder();
$menu_builder->SetDatabase($database);
$menu_builder->SetName("Administração");
$screen_name = $menu_builder->GetScreenName();
echo $screen_name;
?>

				</td>
			</tr>

<?php 
$result = $menu_builder->Build();
while ($data = $database->FetchArray($result)) {
    echo "<tr>";
    echo "<td bgcolor=\"#FFFFFF\" align=\"center\" width=\"100%\">";
    echo "<a href=\"" . $data["modu_url"] . "\">" . $data["modu_name"] . "</a>";
コード例 #9
0
ファイル: where_i_am.page.php プロジェクト: mbcraft/frozen
<?php

Html::set_title("Where i am - SimpleSampleSite");
Html::set_layout("simplesamplesite_dovesono");
include "include/layouts/page_common.php.inc";
start_sector("/contenuto");
?>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<?php 
end_sector();
start_sector("/main_menu");
MenuBuilder::build("main", "/contenuti/it/");
end_sector();
コード例 #10
0
<?php

/**
 * Rebuild out menu mb_sequence table if change
 *
 * @var modX $modx
 * @var modResource $resource
 * @var modResource $nodesAffected
 */
$core_path = $modx->getOption('menubuilder.core_path', null, $modx->getOption('core_path') . 'components/menubuilder/');
require_once $core_path . 'model/menubuilder/MenuBuilder.php';
$menuBuilder = new MenuBuilder($modx);
$eventName = $modx->event->name;
if ($modx->getOption('menubuilder.logDebug', null, false)) {
    $menuBuilder->setDebug();
    $modx->log(modX::LOG_LEVEL_ERROR, '[MenuBuilder::Plugin] Called on Event: ' . $eventName);
}
switch ($eventName) {
    case 'OnCacheUpdate':
        // complete rebuild:
        if ($modx->getOption('menubuilder.rebuildOnCacheUpdate', null, true)) {
            $menuBuilder->buildTree();
        }
        break;
    case 'OnResourceSort':
        // @TODO review to brake down to affected branches see: \core\model\modx\processors\resource\sort.class.php
        // menubuilder.fireOnResourceSort
        if ($modx->getOption('menubuilder.rebuildOnResourceSort', null, true)) {
            // $nodesAffected ~ array of resources
            $menuBuilder->buildTree();
        }
コード例 #11
0
 * Written by: Bruno Schifer Bernardi
 * Last Updated: July 31, 2007
 */
/* Dependencies
 *
 * require src/cdMenuBuilder.php
 *
 */
?>

		<table width="100%" cellspacing="1" bgcolor="#000080">
			<tr>
				<td bgcolor="#DDDDDD" align="center" width="100%">

<?php 
$menu_builder = new MenuBuilder();
$menu_builder->SetDatabase($database);
$menu_builder->SetName("Cursos");
$menu_builder->SetOrder(ORDER_BY_ORDER);
$screen_name = $menu_builder->GetScreenName();
echo $screen_name;
?>

				</td>
			</tr>

<?php 
$result = $menu_builder->Build();
while ($data = $database->FetchArray($result)) {
    echo "<tr>";
    echo "<td bgcolor=\"#FFFFFF\" align=\"center\" width=\"100%\">";
コード例 #12
0
// Seitenauswertung für Gruppen pro Seite und Setzen der Seiten-Arrays
for ($i = 0; $i < $num_rows; $i++) {
    $page_id = $results_array['page_id'];
    $admin_groups = $results_array['admin_groups'];
    $oag = explode(',', $results_array['admin_groups']);
    //old admin groups
    $anz_oag = count($oag);
    for ($j = 0; $j < $anz_oag; $j++) {
        // Setzen des Ergebnisvektors
        $matrix[$page_id][$oag[$j]] = 1;
    }
    // Setzen der Seiten-Zuordnungsarrays für Nummerierung und reverse
    $page_index[$page_id] = $i;
    $index_page[$i] = $page_id;
    // Lesen naechster Satz Seiten
    $results_array = $results->fetchRow();
}
// Einlesen und Darstellen des Menus
include 'class.menu.php';
$menu = new MenuBuilder();
$menu->get_menu_html();
echo '<tr><td colspan="3">
<input type="submit" onmouseover="checkForm(' . $num_rows . ',' . $num_rowg . ',\'' . LANGUAGE . '\');" name="submit" value="' . $MOD_PAGE_PERMISSION['TXT_SUBMIT'] . '" />
<input type="reset" name="reset" value="' . $MOD_PAGE_PERMISSION['TXT_RESET'] . '" /></td>
</tr>
</table>';
//Uebergabe Anzahl Seiten, Anzahl Gruppen
echo '<input type="hidden" name="pages" value="' . $num_rows . '" />
<input type="hidden" name="groups" value="' . $num_rowg . '" />
</form>
';
コード例 #13
0
 /**
  * Build a child menu item as the descendent of a previously created menu item.
  *
  * @param MenuModel $descendant
  * @param MenuItem|MenuBuilder  $menuItem parent menu item
  * @return MenuItem
  */
 protected function renderChildNode(MenuModel $descendant, $menuItem)
 {
     /** @var MenuItem $childNode */
     $childNode = $menuItem->add($descendant->name, $this->getMenuData($descendant));
     return $childNode;
 }