function getFirstLevelItem($mitem)
 {
     global $Itemid, $mosConfig_live_site, $mainframe, $sess;
     $txt = '';
     switch ($mitem->type) {
         case 'separator':
         case 'component_item_link':
             break;
         case 'content_item_link':
             $temp = split("&task=view&id=", $mitem->link);
             $mitem->link .= '&Itemid=' . $mainframe->getItemid($temp[1]);
             break;
         case 'url':
             if (eregi('index.php\\?', $mitem->link)) {
                 if (!eregi('Itemid=', $mitem->link)) {
                     $mitem->link .= '&Itemid=' . $mitem->id;
                 }
             }
             break;
         case 'content_typed':
         default:
             $mitem->link .= '&Itemid=' . $sess->getShopItemid();
             break;
     }
     $id = 'id="menu' . $mitem->id . '"';
     $mitem->link = vmAmpReplace($mitem->link);
     if (strcasecmp(substr($mitem->link, 0, 4), 'http')) {
         $mitem->link = sefRelToAbs($mitem->link);
     }
     $menuclass = 'mainlevel' . $this->parent->_params->get('class_sfx');
     // Active Menu highlighting
     $current_itemid = trim(vmRequest::getInt('Itemid'));
     if (in_array($mitem->id, $this->parent->open)) {
         $menuclass = 'mainlevel_active' . $this->parent->_params->get('class_sfx');
     }
     switch ($mitem->browserNav) {
         // cases are slightly different
         case 1:
             // open in a new window
             $txt = '<a href="' . $mitem->link . '" target="_blank" class="' . $menuclass . '" ' . $id . '>' . $mitem->name . '</a>';
             break;
         case 2:
             // open in a popup window
             $txt = "<a href=\"#\" onclick=\"javascript: window.open('" . $mitem->link . "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\" class=\"{$menuclass}\" " . $id . ">" . $mitem->name . "</a>\n";
             break;
         case 3:
             // don't link it
             $txt = '<span class="' . $menuclass . '" ' . $id . '>' . $mitem->name . '</span>';
             break;
         default:
             // formerly case 2
             // open in parent window
             $txt = '<a href="' . $mitem->link . '" class="' . $menuclass . '" ' . $id . '>' . $mitem->name;
             if ($this->parent->hasSubItems($mitem->id)) {
                 $txt .= '&nbsp;&nbsp;<img border="0" src="' . $this->parent->_params->get('LSPath') . '/img/tabarrow.gif" alt="arrow" />';
             }
             $txt .= '</a>';
             break;
     }
     if ($this->parent->_params->get('menu_images')) {
         $menu_params = new stdClass();
         $menu_params =& new mosParameters($mitem->params);
         $menu_image = $menu_params->def('menu_image', -1);
         if ($menu_image != '-1' && $menu_image) {
             $image = '<img src="' . $mosConfig_live_site . '/images/stories/' . $menu_image . '" border="0" alt="' . $mitem->name . '"/>';
             if ($this->parent->_params->get('menu_images_align')) {
                 $txt = $txt . ' ' . $image;
             } else {
                 $txt = $image . ' ' . $txt;
             }
         }
     }
     return $txt;
 }
Example #2
0
 function genMenuItem(&$row, $level, $pos)
 {
     global $Itemid, $mosConfig_live_site, $mainframe;
     $txt = '';
     switch ($row->type) {
         case 'separator':
         case 'component_item_link':
             break;
         case 'url':
             if (eregi('index.php\\?', $row->link)) {
                 if (!eregi('Itemid=', $row->link)) {
                     $row->link .= '&Itemid=' . $row->id;
                 }
             }
             break;
         case 'content_item_link':
         case 'content_typed':
             // load menu params
             $menuparams = new mosParameters($row->params, $mainframe->getPath('menu_xml', $row->type), 'menu');
             $unique_itemid = $menuparams->get('unique_itemid', 1);
             if ($unique_itemid) {
                 $row->link .= '&Itemid=' . $row->id;
             } else {
                 $temp = split('&task=view&id=', $row->link);
                 if ($row->type == 'content_typed') {
                     $row->link .= '&Itemid=' . $mainframe->getItemid($temp[1], 1, 0);
                 } else {
                     $row->link .= '&Itemid=' . $mainframe->getItemid($temp[1], 0, 1);
                 }
             }
             break;
         default:
             $row->link .= '&Itemid=' . $row->id;
             break;
     }
     $row->link = ampReplace($row->link);
     if (strcasecmp(substr($row->link, 0, 4), 'http')) {
         $row->link = sefRelToAbs($row->link);
     }
     $active = in_array($row->id, $this->parent->open) ? "class = \"active\"" : "";
     $id = 'id="menu' . $row->id . '"';
     $txt = $row->name;
     if ($this->getParam('menu_images')) {
         $menu_params = new stdClass();
         $menu_params =& new mosParameters($row->params);
         $menu_image = $menu_params->def('menu_image', -1);
         if ($menu_image != '-1' && $menu_image) {
             $image = '<img src="' . $mosConfig_live_site . '/images/stories/' . $menu_image . '" border="0" alt="' . $row->name . '"/>';
             if ($this->getParam('menu_images_align')) {
                 $txt = $txt . ' ' . $image;
             } else {
                 $txt = $image . ' ' . $txt;
             }
         }
     }
     $title = " title=\"{$row->name}\"";
     if ($active) {
         $active = $row->parent == 0 && $pos == 0 ? "class=\"active-first-item\"" : "class = \"active\"";
     } else {
         $active = $row->parent == 0 && $pos == 0 ? "class=\"first-item\"" : "";
     }
     switch ($row->browserNav) {
         // cases are slightly different
         case 1:
             // open in a new window
             $txt = '<a href="' . $row->link . '" target="_blank" ' . $active . ' ' . $id . $title . '><span>' . $txt . '</span></a>';
             break;
         case 2:
             // open in a popup window
             $txt = "<a href=\"#\" onclick=\"javascript: window.open('" . $row->link . "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\"  " . $active . " " . $id . $title . "><span>" . $txt . "</span></a>\n";
             break;
         case 3:
             // don't link it
             $txt = '<a href="#" ' . $active . ' ' . $id . $title . '><span>' . $txt . '</span></a>';
             break;
         default:
             // formerly case 2
             // open in parent window
             $txt = '<a href="' . $row->link . '" ' . $active . ' ' . $id . $title . '><span>' . $txt . '</span></a>';
             break;
     }
     echo $txt;
 }
Example #3
0
File: content.php Project: cwcw/cms
function showArchiveSection($id = NULL, $gid, &$access, $pop, $option)
{
    global $database, $mainframe, $mosConfig_offset;
    global $Itemid;
    $noauth = !$mainframe->getCfg('shownoauth');
    // Paramters
    $year = mosGetParam($_REQUEST, 'year', date('Y'));
    $month = mosGetParam($_REQUEST, 'month', date('m'));
    $params = new stdClass();
    if ($Itemid) {
        $menu = new mosMenu($database);
        $menu->load($Itemid);
        $params =& new mosParameters($menu->params);
    } else {
        $menu = "";
        $params =& new mosParameters('');
    }
    $params->set('intro_only', 1);
    $params->set('year', $year);
    $params->set('month', $month);
    // Ordering control
    $orderby_sec = $params->def('orderby_sec', 'rdate');
    $orderby_pri = $params->def('orderby_pri', '');
    $order_sec = _orderby_sec($orderby_sec);
    $order_pri = _orderby_pri($orderby_pri);
    // used in query
    $where = _where(-1, $access, $noauth, $gid, $id, NULL, $year, $month);
    // checks to see if 'All Sections' options used
    if ($id == 0) {
        $check = '';
    } else {
        $check = 'AND a.sectionid = ' . $id;
    }
    // query to determine if there are any archived entries for the section
    $query = "SELECT a.id" . "\n FROM #__content as a" . "\n WHERE a.state = '-1'" . $check;
    $database->setQuery($query);
    $items = $database->loadObjectList();
    $archives = count($items);
    // Main Query
    $query = "SELECT a.*, ROUND(v.rating_sum/v.rating_count) AS rating, v.rating_count, u.name AS author, u.usertype, cc.name AS category, g.name AS groups" . "\n FROM #__content AS a" . "\n INNER JOIN #__categories AS cc ON cc.id = a.catid" . "\n LEFT JOIN #__users AS u ON u.id = a.created_by" . "\n LEFT JOIN #__content_rating AS v ON a.id = v.content_id" . "\n LEFT JOIN #__sections AS s ON a.sectionid = s.id" . "\n LEFT JOIN #__groups AS g ON a.access = g.id" . (count($where) ? "\n WHERE " . implode("\n AND ", $where) : '') . "\n AND s.access <= " . $gid . "\n ORDER BY " . $order_pri . $order_sec;
    $database->setQuery($query);
    $rows = $database->loadObjectList();
    // initiate form
    echo '<form action="' . sefRelToAbs('index.php?option=' . $option . '&amp;task=archivesection&amp;id=' . $id . '&amp;Itemid=' . $Itemid) . '" method="post">';
    // Dynamic Page Title
    $mainframe->SetPageTitle($menu->name);
    if (!$archives) {
        // if no archives for category, hides search and outputs empty message
        echo '<br /><div align="center">' . _CATEGORY_ARCHIVE_EMPTY . '</div>';
    } else {
        BlogOutput($rows, $params, $gid, $access, $pop, $menu, 1);
    }
    echo '</form>';
}
Example #4
0
 /**
  * Utility function for writing a menu link
  */
 function mosGetMenuLink($mitem, $level = 0, &$params)
 {
     global $Itemid, $mosConfig_live_site, $mainframe;
     $txt = '';
     switch ($mitem->type) {
         case 'separator':
         case 'component_item_link':
             break;
         case 'content_item_link':
             $temp = split("&task=view&id=", $mitem->link);
             $mitem->link .= '&Itemid=' . $mainframe->getItemid($temp[1]);
             break;
         case 'url':
             if (eregi('index.php\\?', $mitem->link)) {
                 if (!eregi('Itemid=', $mitem->link)) {
                     $mitem->link .= '&Itemid=' . $mitem->id;
                 }
             }
             break;
         case 'content_typed':
         default:
             $mitem->link .= '&Itemid=' . $mitem->id;
             break;
     }
     // Active Menu highlighting
     $current_itemid = trim(mosGetParam($_REQUEST, 'Itemid', 0));
     if (!$current_itemid) {
         $id = '';
     } else {
         if ($current_itemid == $mitem->id) {
             $id = 'id="active_menu' . $params->get('class_sfx') . '"';
         } else {
             $id = '';
         }
     }
     $mitem->link = str_replace('&', '&amp;', $mitem->link);
     if (strcasecmp(substr($mitem->link, 0, 4), 'http')) {
         $mitem->link = sefRelToAbs($mitem->link);
     }
     $menuclass = 'mainlevel' . $params->get('class_sfx');
     if ($level > 0) {
         $menuclass = 'sublevel' . $params->get('class_sfx ');
     }
     switch ($mitem->browserNav) {
         // cases are slightly different
         case 1:
             // open in a new window
             $txt = '<a href="' . $mitem->link . '" target="_blank" class="' . $menuclass . '" ' . $id . '>' . $mitem->name . '</a>';
             break;
         case 2:
             // open in a popup window
             $txt = "<a href=\"#\" onclick=\"javascript: window.open('" . $mitem->link . "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\" class=\"{$menuclass}\" " . $id . ">" . $mitem->name . "</a>\n";
             break;
         case 3:
             // don't link it
             $txt = '<span class="' . $menuclass . '" ' . $id . '>' . $mitem->name . '</span>';
             break;
         default:
             // formerly case 2
             // open in parent window
             $txt = '<a href="' . $mitem->link . '" class="' . $menuclass . '" ' . $id . '>' . $mitem->name . '</a>';
             break;
     }
     if ($params->get('menu_images')) {
         $menu_params = new stdClass();
         $menu_params =& new mosParameters($mitem->params);
         $menu_image = $menu_params->def('menu_image', -1);
         if ($menu_image != '-1' && $menu_image) {
             $image = '<img src="' . $mosConfig_live_site . '/images/stories/' . $menu_image . '" border="0" alt="' . $mitem->name . '"/>';
             if ($params->get('menu_images_align')) {
                 $txt = $txt . ' ' . $image;
             } else {
                 $txt = $image . ' ' . $txt;
             }
         }
     }
     return $txt;
 }