Exemple #1
0
    function menu()
    {
        global $JVVERSION;
        $latest_version = '';
        $version_link = JAVoiceHelpers::get_Version_Link();
        $layout = JRequest::getVar('layout', 'statistic');
        $cid = JRequest::getVar('cid');
        if (is_array($cid)) {
            JArrayHelper::toInteger($cid);
            $cid = $cid[0];
        }
        $latest_version = $this->get('LatestVersion');
        if ($latest_version) {
            $version_link['latest_version']['info'] = 'http://wiki.joomlart.com/wiki/JA_Voice/Overview';
            $version_link['latest_version']['upgrade'] = 'http://www.joomlart.com/forums/downloads.php?do=cat&id=139';
            $iLatest_version = str_replace('.', '', $latest_version);
            $iLatest_version = trim($iLatest_version);
            $iLatest_version = intval($iLatest_version);
        } else {
            $version_link['latest_version']['info'] = '';
            $version_link['latest_version']['upgrade'] = '';
        }
        //$xml = JFactory::getXMLParser( 'simple' );
        $xml = new JSimpleXML();
        $file = JPATH_COMPONENT . '/javoice.xml';
        $xml->loadFile($file);
        $out = $xml->document;
        if ($out == false) {
            $current_version = $JVVERSION;
        } else {
            $allComments = $out->children();
            foreach ($allComments as $blogpost) {
                if ($blogpost->name() == "version") {
                    $current_version = $blogpost->data();
                    break;
                }
            }
        }
        $iCurrent_version = str_replace('.', '', $current_version);
        $iCurrent_version = trim($iCurrent_version);
        $iCurrent_version = intval($iCurrent_version);
        ?>
		<fieldset class="adminform">
					<div class="submenu-box">
						<div class="submenu-pad">
		<ul id="submenu" class="configuration">
			<li><a href="index.php?option=com_javoice&layout=statistic"
				class="<?php 
        if ($layout == null || $layout == 'statistic') {
            echo 'active';
        }
        ?>
">
										<?php 
        echo JText::_('STATISTICS');
        ?>
									</a></li>
			<li><a href="index.php?option=com_javoice&layout=supportandlicense"
				class="<?php 
        if ($layout == 'supportandlicense' || $layout == 'verify') {
            echo 'active';
        }
        ?>
">
										<?php 
        echo JText::_('DOCUMENTATION_AND_SUPPORT');
        ?>
									</a></li>			
			<li style="float: right;line-height:30px;">
				<?php 
        if (empty($iLatest_version)) {
            echo JText::_('VERSION') . ' <b>' . $current_version . '</b>';
        } elseif (!empty($iLatest_version) && $iLatest_version <= $iCurrent_version) {
            echo JText::_('YOUR_VERSION') . ': <b><a href="' . $version_link['current_version']['info'] . '" target="_blank">' . $current_version . '</a></b>&nbsp;&nbsp;' . JText::_('LATEST_VERSION') . ': <b><a href="' . $version_link['latest_version']['info'] . '" target="_blank">' . $latest_version . '</a></b>&nbsp;&nbsp;<font color="Blue"> <i>(' . JText::_('SYSTEM_RUNNING_THE_LATEST_VERSION') . ')</i></font>';
        } elseif (!empty($iLatest_version) && $iLatest_version > $iCurrent_version) {
            echo JText::_('YOUR_VERSION') . ': <b><a href="' . $version_link['current_version']['info'] . '" target="_blank">' . $current_version . '</a></b>&nbsp;&nbsp;' . JText::_('LATEST_VERSION') . ': <b>';
            echo isset($version_link['latest_version']) ? '<a href="' . $version_link['latest_version']['info'] . '" target="_blank">' . $latest_version . '</a>' : $latest_version;
            echo '</b>&nbsp;&nbsp;<span style="background-color:rgb(255,255,0);color:Red;font-weight:bold;">' . JText::_('NEW_VERSION_AVAILABLE') . '</span>';
            if (isset($version_link['latest_version'])) {
                echo '<a target="_blank" href="' . $version_link['latest_version']['upgrade'] . '" title="' . JText::_('CLICK_HERE_TO_DOWNLOAD_LATEST_VERSION') . '">' . JText::_('UPGRADE_NOW') . '</a>';
            }
        }
        ?>
					
			</li>
		</ul>
		<div class="clr"></div>
						</div>
					</div>
					<div class="clr"></div>
				</fieldset>
<?php 
    }