small upgrade for Admin Module Manager

General Chat, Comments
Post Reply
illusions
Posts: 31
Joined: Thu Mar 06, 2014 12:46 pm

small upgrade for Admin Module Manager

Post by illusions »

this is a very small upgrade for the Admin Module Manager which lets you view the Freebies and the paid Mods Seperately also added an up/down option for viewing.
ive added 2 images for you to view so heres how it works first to make the sections retract..

find your TableHeader statements and change them so from

Code: Select all

 TableHeader("Modules to upgrade");
To

Code: Select all

TableHeader(Translate("Modules To Upgrade"), true, true);
do that to each TableHeader and you can now Retract between closed and open options..

Now to add the Freebie section..

Code: Select all

    if (count($availableModules) > 0)
        {
            TableHeader(Translate("Free Modules Available"), true, true);
            if (count($availableModules) > 5)
                echo "<div style='height: 150px; overflow: auto;'>";
            echo "<table class='plainTable'>";
            echo "<tr class='titleLine'>";
            echo "<td colspan='2'> </td>";
            echo "<td>" . Translate('Name') . "</td>";
            echo "<td>" . Translate('Author') . "</td>";
            echo "<td>" . Translate('Type') . "</td>";
            echo "<td>" . Translate('Price') . "</td>";
            echo "</tr>";
            $row = 0;
            foreach ($availableModules as $m)
            {
                if ($row % 2 == 0)
                    echo "<tr class='evenLine' valign='top'>";
                else
                    echo "<tr class='oddLine' valign='top'>";
                if ($m[3] == 0) {
                echo "<td width='1%'>";
                LinkButton("Ignore", "index.php?p=admin_module_manager&ignore=" . urlencode($m[1]), "return confirm(unescape('" . rawurlencode(Translate("Are you sure you don't want to see this module in this list anymore?")) . "'));");
                echo "</td>";
			}
                
                if ($m[3] == 0)
                {
                    echo "<td width='1%'>";
                    LinkButton("Install", "index.php?p=admin_module_manager&install=" . urlencode($m[1]));
                    echo "</td>";
                }
                elseif ($m[3] < 0)
                {
                    echo "<td width='1%'>";
                    LinkButton("Check", "http://nwe.funmayhem.com/index.php?c=modules&m=" . $m[0], null, "NW-SHOP");
                    echo "</td>";
                }
				if ($m[3] == 0) {
                echo "<td><a href='http://nwe.funmayhem.com/index.php?c=modules&m={$m[0]}' target='NW-SHOP'>{$m[1]}</a></td>";
				}
				if ($m[3] == 0) {
                echo "<td>{$m[5]}</td>";
				}
				if ($m[3] == 0)
                echo "<td>{$m[2]}</td>";
                if ($m[3] == 0)
                    echo "<td align='right'><b>" . Translate("free") . "</b> </td>";
                elseif ($m[3] < 0)
                    echo "<td align='right'>{$m[3]}  TEST</td>";
                echo "</tr>";
                $row ++;
            }
            echo "</table>";
            if (count($availableModules) > 5)
                echo "</div>";
            TableFooter();
        }
you will need to Ammend the Available Modules section so it removes the Free Items so i'll do that for you here

Code: Select all

	if (count($availableModules) > 0)
        {
			
             TableHeader(Translate("Available Paid Modules"), true, true);
			 
            if (count($availableModules) > 5)
                echo "<div style='height: 150px; overflow: auto;'>";
            echo "<table class='plainTable'>";
            echo "<tr class='titleLine'>";
            echo "<td colspan='2'> </td>";
            echo "<td>" . Translate('Name') . "</td>";
            echo "<td>" . Translate('Author') . "</td>";
            echo "<td>" . Translate('Type') . "</td>";
            echo "<td>" . Translate('Price') . "</td>";
            echo "</tr>";
            $row = 0;
            foreach ($availableModules as $m)
            {
                if ($row % 2 == 0)
                    echo "<tr class='evenLine' valign='top'>";
                else
                    echo "<tr class='oddLine' valign='top'>";
				
				
                if ($m[3] > 1) {
                echo "<td width='1%'>";
                LinkButton("Ignore", "index.php?p=admin_module_manager&ignore=" . urlencode($m[1]), "return confirm(unescape('" . rawurlencode(Translate("Are you sure you don't want to see this module in this list anymore?")) . "'));");
                echo "</td>";
			}
                
                if ($m[3] > 1)
                {
                    echo "<td width='1%'>";
                    LinkButton("Install", "index.php?p=admin_module_manager&install=" . urlencode($m[1]));
                    echo "</td>";
                }
                elseif ($m[3] < 0)
                {
                    echo "<td width='1%'>";
                    LinkButton("Check", "http://nwe.funmayhem.com/index.php?c=modules&m=" . $m[0], null, "NW-SHOP");
                    echo "</td>";
                }
				if ($m[3] > 1) {
                echo "<td><a href='http://nwe.funmayhem.com/index.php?c=modules&m={$m[0]}' target='NW-SHOP'>{$m[1]}</a></td>";
				}
				if ($m[3] > 1) {
                echo "<td>{$m[5]}</td>";
				}
				if ($m[3] > 1)
                echo "<td>{$m[2]}</td>";
                if ($m[3] > 1)
                    echo "<td align='right'>{$m[3]} </td>";
				//echo "<td>" . GetModuleVersion($m) . "</td>";
                
                echo "</tr>";
                $row ++;
            }
            echo "</table>";
            if (count($availableModules) > 5)
                echo "</div>";
            TableFooter();
        }
and your good to go
Post Reply

Return to “General”