function doViewShippingZones($msg = null) { $rows = shipZone::getAll(); if (!$msg) { $msg = JRequest::getVar('msg'); } if ($msg) { shipping_HTML::viewShippingZones($rows, $msg); } else { shipping_HTML::viewShippingZones($rows); } }
// execute the task $c->redirect(); // redirect if set in the class break; case "shipping": switch ($task) { case 'save': JRequest::setvar('task', "shipping"); //shipping::doViewShippingZones(); $msg = shipping::saveShipping(); $mainframe->redirect("index.php?option=com_caddy&action=shipping&task=show", $msg); break; case 'add': case 'edit': $row = shipping::prepareEditShipping($cid); shipping_HTML::editShipping($row); break; case 'remove': JRequest::setvar('task', "shipping"); shipping::doViewShippingZones(shipping::deleteZone($cid)); break; case 'show': default: JRequest::setvar('task', "shipping"); shipping::doViewShippingZones(); break; } break; case "configuration": switch ($task) { case "saveconfig":
function viewShippingZones($rows, $msg = null) { JToolBarHelper::title(JText::_('SimpleCaddy Shipping Zones')); JToolBarHelper::addnew('add'); JToolbarHelper::save('edit', JText::_('edit')); JToolBarHelper::deleteList(); JToolBarHelper::custom('control', 'back.png', 'back.png', 'Main', false, false); if ($msg) { ?> <fieldset> <legend><?php echo JText::_('SC_SHIPPING_NOTICE'); ?> </legend> <?php if ($msg) { echo $msg; } ?> </fieldset> <?php } ?> <fieldset class='adminForm'> <legend><?php echo JText::_('SC_SHIPPING_ZONE_VIEW'); ?> </legend> <form name='adminForm' method='get' action='index2.php'> <table class='adminlist'> <thead > <tr > <th class="title" nowrap="nowrap"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($rows); ?> );" /></th> <th class="title" nowrap="nowrap"><?php echo JText::_('SC_SHIPPING_EDIT_ID'); ?> </th> <th class="title" nowrap="nowrap"><?php echo JText::_('SC_SHIPPING_EDIT_NAME'); ?> </th> <th class="title" nowrap="nowrap"><?php echo JText::_('SC_SHIPPING_EDIT_LOWER'); ?> </th> <th class="title" nowrap="nowrap"><?php echo JText::_('SC_SHIPPING_EDIT_UPPER'); ?> </th> <th class="title" nowrap="nowrap"><?php echo JText::_('SC_SHIPPING_EDIT_PRICE'); ?> </th> <th> </th> </tr> </thead> <?php $k = 0; for ($i = 0, $n = count($rows); $i < $n; $i++) { $row =& $rows[$i]; ?> <tr class="<?php echo "row{$k}"; ?> "> <td width="20"><input type="checkbox" id="cb<?php echo $i; ?> " name="cid[]" value="<?php echo $row->id; ?> " onclick="isChecked(this.checked);" /></td> <td width="40"> <a href="index2.php?cid[]=<?php echo $row->id; ?> &option=com_caddy&action=shipping&task=edit&hidemainmenu=1" > <?php echo $row->id; ?> </a> </td> <td width="150"> <a href="index2.php?cid[]=<?php echo $row->id; ?> &option=com_caddy&action=shipping&task=edit&hidemainmenu=1" > <?php echo $row->name; ?> </a> </td> <td width="150"><?php echo $row->points_lower; ?> </td> <td width="150"><?php echo $row->points_upper; ?> </td> <td width="200"><?php echo shipping_HTML::displayMoney($row->price); ?> </td> <td> </td> </tr> <?php $k = 1 - $k; ?> <?php } ?> </table> <input type="hidden" name="option" value="com_caddy" /> <input type="hidden" name="action" value="shipping" /> <input type="hidden" name="task" value="" /> <input type="hidden" name="boxchecked" value="0" /> <input type="hidden" name="hidemainmenu" value="1" /> </form> </fieldset> <?php }