예제 #1
0
 protected function createDefaultSitemap()
 {
     $db = JFactory::getDbo();
     // Check if we have any sitemap, otherwise lets create a default one
     $query = $db->getQuery(true)->select('COUNT(*)')->from('#__osmap_sitemap');
     $db->setQuery($query);
     $noSitemaps = (int) $db->loadResult() === 0;
     if ($noSitemaps) {
         // Get all menus
         $menus = ModMenuHelper::getMenus();
         if (!empty($menus)) {
             $selections = new stdClass();
             $i = 0;
             foreach ($menus as $menu) {
                 $selection = new stdClass();
                 $selection->priority = 0.5;
                 $selection->changefreq = 'weekly';
                 $selection->ordering = $i++;
                 $selections->{$menu->menutype} = $selection;
             }
             $attribs = new stdClass();
             $attribs->showintro = "1";
             $attribs->show_menutitle = "1";
             $attribs->classname = "";
             $attribs->columns = "";
             $attribs->exlinks = "img_blue.gif";
             $attribs->compress_xml = "1";
             $attribs->beautify_xml = "1";
             $attribs->include_link = "1";
             $attribs->news_publication_name = "";
             $config = JFactory::getConfig();
             $data = array('title' => 'Sitemap', 'alias' => 'sitemap', 'attribs' => json_encode($attribs), 'selections' => json_encode($selections), 'is_default' => 1, 'state' => 1, 'access' => (int) $config->get('access', 1));
             JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_osmap/tables');
             $table = JTable::getInstance('Sitemap', 'OSMapTable');
             $table->bind($data);
             $table->store();
         }
     }
 }
예제 #2
0
/*
 * Menus Submenu
 */
if ($user->authorise('core.manage', 'com_menus')) {
    $menu->addChild(new JMenuNode(JText::_('MOD_MENU_MENUS'), '#'), true);
    $createMenu = $shownew && $user->authorise('core.create', 'com_menus');
    $menu->addChild(new JMenuNode(JText::_('MOD_MENU_MENU_MANAGER'), 'index.php?option=com_menus&view=menus', 'class:menumgr'), $createMenu);
    if ($createMenu) {
        $menu->addChild(new JMenuNode(JText::_('MOD_MENU_MENU_MANAGER_NEW_MENU'), 'index.php?option=com_menus&view=menu&layout=edit', 'class:newarticle'));
        $menu->getParent();
    }
    $menu->addSeparator();
    $menu->addChild(new JMenuNode(JText::_('MOD_MENU_MENUS_ALL_ITEMS'), 'index.php?option=com_menus&view=items&menutype=', 'class:allmenu'));
    $menu->addSeparator();
    // Menu Types
    $menuTypes = ModMenuHelper::getMenus();
    $menuTypes = JArrayHelper::sortObjects($menuTypes, 'title', 1, false);
    foreach ($menuTypes as $menuType) {
        if (!$user->authorise('core.manage', 'com_menus.menu.' . (int) $menuType->id)) {
            continue;
        }
        $alt = '*' . $menuType->sef . '*';
        if ($menuType->home == 0) {
            $titleicon = '';
        } elseif ($menuType->home == 1 && $menuType->language == '*') {
            $titleicon = ' <span class="icon-home"></span>';
        } elseif ($menuType->home > 1) {
            $titleicon = ' <span>' . JHtml::_('image', 'mod_languages/icon-16-language.png', $menuType->home, array('title' => JText::_('MOD_MENU_HOME_MULTIPLE')), true) . '</span>';
        } else {
            $image = JHtml::_('image', 'mod_languages/' . $menuType->image . '.gif', null, null, true, true);
            if (!$image) {
예제 #3
0
    $menu->getParent();
}
//
// Menus Submenu
//
if ($user->authorise('core.manage', 'com_menus')) {
    $menu->addChild(new JMenuNode(JText::_('MOD_MENU_MENUS'), '#'), true);
    $createMenu = $shownew && $user->authorise('core.create', 'com_menus');
    $menu->addChild(new JMenuNode(JText::_('MOD_MENU_MENU_MANAGER'), 'index.php?option=com_menus&view=menus', 'class:menumgr'), $createMenu);
    if ($createMenu) {
        $menu->addChild(new JMenuNode(JText::_('MOD_MENU_MENU_MANAGER_NEW_MENU'), 'index.php?option=com_menus&view=menu&layout=edit', 'class:newarticle'));
        $menu->getParent();
    }
    $menu->addSeparator();
    // Menu Types
    foreach (ModMenuHelper::getMenus() as $menuType) {
        $alt = '*' . $menuType->sef . '*';
        if ($menuType->home == 0) {
            $titleicon = '';
        } elseif ($menuType->home == 1 && $menuType->language == '*') {
            $titleicon = ' <span>' . JHtml::_('image', 'menu/icon-16-default.png', '*', array('title' => JText::_('MOD_MENU_HOME_DEFAULT')), true) . '</span>';
        } elseif ($menuType->home > 1) {
            $titleicon = ' <span>' . JHtml::_('image', 'menu/icon-16-language.png', $menuType->home, array('title' => JText::_('MOD_MENU_HOME_MULTIPLE')), true) . '</span>';
        } else {
            $image = JHtml::_('image', 'mod_languages/' . $menuType->image . '.gif', NULL, NULL, true, true);
            if (!$image) {
                $titleicon = ' <span>' . JHtml::_('image', 'menu/icon-16-language.png', $alt, array('title' => $menuType->title_native), true) . '</span>';
            } else {
                $titleicon = ' <span>' . JHtml::_('image', 'mod_languages/' . $menuType->image . '.gif', $alt, array('title' => $menuType->title_native), true) . '</span>';
            }
        }