function showItem(&$item, &$menu) { ?> <li id="idrops-<?php echo $item->id; ?>" parent_id="idrops-<?php echo $item->parent; ?>" <?php if($item->hasListItemClasses()) : ?>class="<?php echo $item->getListItemClasses();?>"<?php endif;?> <?php if(isset($item->css_id)):?>id="<?php echo $item->css_id;?>"<?php endif;?>> <?php if ($item->type == 'menuitem') : ?> <?php if (count($item->_children) > 0 && $item->parent != 0): ?> <small class="menucount"><?php echo count($item->_children); ?></small> <?php endif; ?> <a <?php if($item->hasLinkClasses()):?>class="<?php echo $item->getLinkClasses();?>"<?php endif;?> <?php if($item->hasLink()):?>href="<?php echo $item->getLink();?>"<?php endif;?> <?php if(isset($item->target)):?>target="<?php echo $item->target;?>"<?php endif;?> <?php if(isset($item->onclick)):?>onclick="<?php echo $item->onclick;?>"<?php endif;?><?php if($item->hasLinkAttribs()):?> <?php echo $item->getLinkAttribs();?><?php endif;?>> <?php if (isset($item->image)):?><img alt="<?php echo $item->alias;?>" src="<?php echo $item->image;?>"/><?php endif; ?> <span <?php if($item->hasSpanClasses()):?>class="<?php echo $item->getSpanClasses();?>"<?php endif; ?>><?php echo $item->title;?></span> </a> <?php elseif($item->type == 'separator') : ?> <?php if (count($item->_children) > 0 && $item->parent != 0): ?> <small class="menucount small"><?php echo count($item->_children); ?></small> <?php endif; ?> <span <?php if($item->hasSpanClasses()):?>class="<?php echo $item->getSpanClasses();?>"<?php endif; ?>><?php echo $item->title;?></span> <?php endif; ?> <?php if ($item->hasChildren()): ?> <ul> <?php // force the parent menu item to appear $cls = explode(" ", $item->getListItemClasses()); $isActive = (in_array('active', $cls)); if ($item->parent != 0) : ?> <li class="subnav"> <a href="#" parent_id="idrops-<?php echo $item->parent; ?>" class="item backmenu"><span>Back</span></a> <a href="#close" class="item closemenu"><span>Close</span></a> <span class="clear"></span> </li> <?php endif; ?> <li class="root-sub<?php echo ($isActive) ? ' active' : ''; ?>"><?php if ($item->type == 'menuitem') : ?> <?php if (count($item->_children) > 0 && (!$item->parent && $item->parent != 0)): ?> <small class="menucount"><?php echo count($item->_children); ?></small> <?php endif; ?> <a <?php if($item->hasLinkClasses()):?>class="<?php echo $item->getLinkClasses();?>"<?php endif;?> <?php if($item->hasLink()):?>href="<?php echo $item->getLink();?>"<?php endif;?> <?php if(isset($item->target)):?>target="<?php echo $item->target;?>"<?php endif;?> <?php if(isset($item->onclick)):?>onclick="<?php echo $item->onclick;?>"<?php endif;?><?php if($item->hasLinkAttribs()):?> <?php echo $item->getLinkAttribs();?><?php endif;?>> <?php if (isset($item->image)):?><img alt="<?php echo $item->alias;?>" src="<?php echo $item->image;?>"/><?php endif; ?> <span <?php if($item->hasSpanClasses()):?>class="<?php echo $item->getSpanClasses();?>"<?php endif; ?>><?php echo $item->title;?></span> </a> <?php elseif($item->type == 'separator') : ?> <span <?php if($item->hasSpanClasses()):?>class="<?php echo $item->getSpanClasses();?>"<?php endif; ?>><?php echo $item->title;?></span> <?php endif; ?> <?php foreach ($item->getChildren() as $child) : ?> <?php showItem($child, $menu); ?> <?php endforeach; ?> </ul> <?php endif; ?> </li> <?php }
function showCompetitionInfos () { #---------------------------------------------------------------------- global $chosenCompetitionId; #--- Get the competition infos from the database. $competition = getFullCompetitionInfos( $chosenCompetitionId ); extract( $competition ); $delegates = getCompetitionDelegates( $chosenCompetitionId ); $wcaDelegate = joinUsers( $delegates, true ); $organizers = getCompetitionOrganizers( $chosenCompetitionId ); // Only show organizer emails if there is no contact info given. $organizer = joinUsers( $organizers, !$contact ); #--- Show the infos. echo "<h1>$name</h1>\n"; #--- Start the table. echo "<div class='table-responsive'>\n"; echo "<table width='100%' id='competitionDetails'><tr valign='top'>\n"; #--- Left part. echo "<td style='width:70%'><table>"; $country = getCountry($countryId); showItem( 'key', "Date", array( competitionDate( $competition ), $year )); showItem( 'key', "City", array( $cityName, $country['name'] )); showItem( 'key', "Venue", array( $venue )); showItem( 'sub', "Address", array( $venueAddress )); showItem( 'sub', "Details", array( $venueDetails )); showItem( 'key', "Website", array( $website )); showItem( 'key', "Organizer", array( $organizer )); showItem( 'key', "WCA Delegate", array( $wcaDelegate )); showItem( 'key', "Contact", array( $contact )); echo "</table></td>"; #--- Right part. echo "<td style='width:30%'><table>"; showItem( 'key', "Information", array( $information )); showListItemNew( 'View results for', computeCompetitionEvents( $eventSpecs )); showListItemNew( 'Reports', computeMedia( 'report' )); showListItemNew( 'Articles', computeMedia( 'article' )); showListItemNew( 'Multimedia', computeMedia( 'multimedia' )); echo "</table></td>"; #--- End table. echo "</tr></table></div>"; }
/** * Displays the page. * * @param $title The title of the page */ function showContent($title) { $db = new DB(); $category = trim($_REQUEST["category"]); $sql = "SELECT ID, image, name, price, description FROM products"; if ($category) { $sql .= " WHERE category = '{$category}'"; } $result = $db->query($sql); echo "<h1>{$title}</h1>\n"; echo "<table border=\"1\">\n"; showHeading(); while ($row = mysql_fetch_row($result)) { list($id, $image, $name, $price, $description) = $row; $price = "\$" . number_format($price, 2); showItem($id, $name, $description, $image, $price); } echo "</table>\n"; }
function showItem(&$item, &$menu) { ?> <li <?php if($item->hasListItemClasses()) : ?>class="<?php echo $item->getListItemClasses();?>"<?php endif;?> <?php if(isset($item->css_id)):?>id="<?php echo $item->css_id;?>"<?php endif;?>> <?php if ($item->type == 'menuitem') : ?> <a <?php if($item->hasLinkClasses()):?>class="<?php echo $item->getLinkClasses();?>"<?php endif;?> <?php if($item->hasLink()):?>href="<?php echo $item->getLink();?>"<?php endif;?> <?php if(isset($item->target)):?>target="<?php echo $item->target;?>"<?php endif;?> <?php if(isset($item->onclick)):?>onclick="<?php echo $item->onclick;?>"<?php endif;?><?php if($item->hasLinkAttribs()):?> <?php echo $item->getLinkAttribs();?><?php endif;?>> <?php if (isset($item->image)):?><img alt="<?php echo $item->alias;?>" src="<?php echo $item->image;?>"/><?php endif; ?> <span <?php if($item->hasSpanClasses()):?>class="<?php echo $item->getSpanClasses();?>"<?php endif; ?>><?php echo $item->title;?></span> </a> <?php elseif($item->type == 'separator') : ?> <span <?php if($item->hasSpanClasses()):?>class="<?php echo $item->getSpanClasses();?>"<?php endif; ?>><?php echo $item->title;?></span> <?php endif; ?> <?php if ($item->hasChildren()): ?> <ul> <?php foreach ($item->getChildren() as $child) : ?> <?php showItem($child, $menu); ?> <?php endforeach; ?> </ul> <?php endif; ?> </li> <?php }
/** * Displays the main content of the page. * * @param $title The title of the page */ function showContent($title) { $db = new DB(); $cartID = getCartID(); $sql = "SELECT ID, name, products.price, quantity, date \n FROM shoppingcarts, products\n WHERE productID=ID AND CartID='{$cartID}'"; $result = $db->query($sql); echo "<h1>{$title}</h1>\n"; echo "<table>\n"; showHeading(); $user = isset($_SESSION['user']) ? $_SESSION['user'] : ""; while ($row = mysql_fetch_row($result)) { list($productId, $prodName, $price, $qty, $date) = $row; $total += $price * $qty; showItem($productId, $prodName, $price, $qty); $sql = "INSERT INTO orders(username, date, status)\n VALUES ('{$user}', '{$date}', 'ordered')"; $db->query($sql); $sql = "INSERT INTO orderItems(orderID, productID, quantity, status)\n VALUES ('LAST_INSERT_ID()', '{$productId}', '{$qty}', 'ordered')"; $db->query($sql); $sql = "DELETE FROM shoppingcarts WHERE CartID='{$cartID}'"; $db->query($sql); } $total = "\$" . number_format($total, 2); showFooter($total); echo "</table>\n"; $sql = "SELECT fname, lname, address, city, state, zip, country\n FROM customers, addresses \n WHERE customers.username=addresses.username \n AND customers.username='******'"; $result = $db->query($sql); $row = mysql_fetch_row($result); list($fname, $lname, $address, $city, $state, $zip, $country) = $row; echo "<p>This order will be shipped to</p>"; echo "<p>{$fname} {$lname}</p>"; echo "<p>{$address}</p>"; echo "<p>{$city}, {$state} {$zip}</p>"; echo "<p>{$country}</p>"; setcookie('cartID', '', time() - 86400, '/'); session_destroy(); }
<?php include_once 'connection/poductData.php'; //include_once 'code/upload.php'; //include_once 'view/upload.html'; $result = showItem(); ?> <html> <head> <link rel="stylesheet" type="text/css" href="css/style.css"> <link rel="stylesheet" type="text/javascript" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"> </head> <body> <div class=Header> </div> <div class=mainContainer> <?php while ($data = $result->fetch_object()) { ?> <div class=rowItem> <div> <a href="view/productInfo.php?id=<?php echo $data->productId; ?> "> <img src="product/<?php echo $data->productImage;
function showItem(&$item, &$menu) { $column_class = ''; $level = 'level' . $item->level; if ($item->level > 0) { if ($menu->multiColLevel == 0 or $menu->multiColLevel > 0 and $item->level == $menu->multiColLevel) { if ($menu->rowsPerColumn > 0) { $position = intval($item->order) - 1; $column_class = ' c' . floor($position / $menu->rowsPerColumn); } elseif ($menu->columns > 0) { $name = $item->title; $parent = $item->getParent(); $siblings = intval($parent->hasChildren()); $position = intval($item->order) - 1; $column_class = ' c' . floor($position / ceil($siblings / $menu->columns)); } } if (!isset($menu->{$level}->currentCol) or $menu->{$level}->currentCol != $column_class) { $menu->{$level}->currentCol = $column_class; $column_class .= ' coltop'; } } ?> <li <?php if ($item->hasListItemClasses()) { ?> class="<?php echo $item->getListItemClasses(); ?> <?php echo $column_class; ?> "<?php } ?> <?php if (isset($item->css_id)) { ?> id="<?php echo $item->css_id; ?> "<?php } ?> > <?php if ($item->type == 'menuitem') { ?> <a <?php if ($item->hasLinkClasses()) { ?> class="<?php echo $item->getLinkClasses(); ?> "<?php } ?> <?php if (isset($item->link)) { ?> href="<?php echo $item->link; ?> "<?php } ?> <?php if (isset($item->target)) { ?> target="<?php echo $item->target; ?> "<?php } ?> <?php if (isset($item->onclick)) { ?> onclick="<?php echo $item->onclick; ?> "<?php } ?> > <?php if (isset($item->image)) { ?> <img alt="<?php echo $item->alias; ?> " src="<?php echo $item->image; ?> "/><?php } ?> <span><?php echo $item->title; ?> </span> </a> <?php } elseif ($item->type == 'separator') { ?> <a <?php if ($item->hasLinkClasses()) { ?> class="<?php echo $item->getLinkClasses(); ?> "<?php } ?> > <span><?php echo $item->title; ?> </span> </a> <?php } ?> <?php if ($item->hasChildren()) { ?> <?php $columnCount = 1; if ($menu->multiColLevel > 0 and intval($item->level) + 1 == $menu->multiColLevel) { if ($menu->rowsPerColumn > 0 and $item->hasChildren() > $menu->rowsPerColumn) { $columnCount = intval($item->hasChildren() / $menu->rowsPerColumn); } elseif ($menu->columns > 0) { $columnCount = $menu->columns; } } ?> <div class="drop-wrap columns-<?php echo $columnCount; ?> "><div class="drop1 png"></div> <ul class="png columns-<?php echo $columnCount; ?> "> <?php foreach ($item->getChildren() as $child) { ?> <?php showItem($child, $menu); ?> <?php } ?> </ul> </div> <?php } ?> </li> <?php }
function showItem(&$i, $c, $pn = '') { ?> <tr<?php if ($i % 2 == 0) { ?> class="even"<?php } ?> id="category-<?php echo $c['mid']; ?> "> <td><input type="checkbox" value="<?php echo $c['mid']; ?> " name="mid[]"></td> <td><?php echo $c['mid']; ?> </td> <td><?php if ($pn) { echo $pn; ?> » <?php } ?> <a href="#" onclick="ajaxLoad('<?php path(array('do' => 'contentManageCategories'), 'AdminDo'); ?> ?mid=<?php echo $c['mid']; ?> ');return false;"><?php echo $c['name']; ?> </a></td> <td><?php echo $c['description']; ?> </td> <td><?php echo $c['alias']; ?> </td> <td><?php echo $c['reply']; ?> </td> </tr> <?php $i++; $pn = $pn ? $pn . ' » ' . $c['name'] : $c['name']; if (isset($c['child'])) { foreach ($c['child'] as $c) { showItem($i, $c, $pn); } } }
// Editor usertype check $access = new stdClass(); $access->canEdit = $acl->acl_check('action', 'edit', 'users', $my->usertype, 'content', 'all'); $access->canEditOwn = $acl->acl_check('action', 'edit', 'users', $my->usertype, 'content', 'own'); $access->canPublish = $acl->acl_check('action', 'publish', 'users', $my->usertype, 'content', 'all'); // cache activation $cache =& mosCache::getCache('com_content'); // loads function for frontpage component if ($option == 'com_frontpage') { //frontpage( $option, $gid, $pop, $now ); $cache->call('frontpage', $gid, $access, $pop, $now); return; } switch (strtolower($task)) { case 'view': showItem($id, $gid, $access, $pop, $option, $now); break; case 'section': $cache->call('showSection', $id, $gid, $access, $now); break; case 'category': $cache->call('showCategory', $id, $gid, $access, $sectionid, $limit, $limitstart, $now); break; case 'blogsection': $cache->call('showBlogSection', $id, $gid, $access, $pop, $now); break; case 'blogcategorymulti': case 'blogcategory': $cache->call('showBlogCategory', $id, $gid, $access, $pop, $now); break; case 'archivesection':
function showItem(&$item, &$menu) { global $activeid; $doc =& JFactory::getDocument(); //get columns count for children $columns = $item->getParameter('fusion_columns', 1); //get custom image $custom_image = $item->getParameter('fusion_customimage'); if ($custom_image && $custom_image != -1) { $item->addLinkClass('image'); } else { $item->addLinkClass('bullet'); } //not so elegant solution to add subtext $item->subtext = $item->getParameter('fusion_item_subtext', ''); if ($item->subtext == '') { $item->subtext = false; } else { $item->addLinkClass('subtext'); } ?> <li <?php if ($item->hasListItemClasses()) { ?> class="<?php echo $item->getListItemClasses(); ?> "<?php } ?> <?php if (isset($item->css_id) && $activeid) { ?> id="<?php echo $item->css_id; ?> "<?php } ?> > <?php if ($item->type == 'menuitem') { ?> <a <?php if ($item->hasLinkClasses()) { ?> class="<?php echo $item->getLinkClasses(); ?> "<?php } ?> <?php if ($item->hasLink()) { ?> href="<?php echo $item->getLink(); ?> "<?php } ?> <?php if (isset($item->target)) { ?> target="<?php echo $item->target; ?> "<?php } ?> <?php if (isset($item->onclick)) { ?> onclick="<?php echo $item->onclick; ?> "<?php } if ($item->hasLinkAttribs()) { ?> <?php echo $item->getLinkAttribs(); } ?> > <span> <?php if ($custom_image && $custom_image != -1) { ?> <img src="<?php echo $doc->baseurl . "/templates/" . FUSION_TEMPLATE . "/images/menus/" . $custom_image; ?> " alt="<?php echo $custom_image; ?> " /> <?php } ?> <?php echo $item->title; ?> <?php if (!empty($item->subtext)) { ?> <em><?php echo $item->subtext; ?> </em> <?php } ?> </span> </a> <?php } elseif ($item->type == 'separator') { ?> <span <?php if ($item->hasLinkClasses()) { ?> class="<?php echo $item->getLinkClasses(); ?> nolink"<?php } ?> > <span> <?php if ($custom_image && $custom_image != -1) { ?> <img src="<?php echo $doc->baseurl . "/templates/" . FUSION_TEMPLATE . "/images/menus/" . $custom_image; ?> " alt="<?php echo $custom_image; ?> " /> <?php } ?> <?php echo $item->title; ?> <?php if (!empty($item->subtext)) { ?> <em><?php echo $item->subtext; ?> </em> <?php } ?> </span> </span> <?php } ?> <?php if ($item->hasChildren()) { ?> <div class="fusion-submenu-wrapper level<?php echo intval($item->level) + 2; if ($columns > 1) { echo ' columns' . $columns; } ?> "> <div class="drop-top"></div> <ul class="level<?php echo intval($item->level) + 2; if ($columns > 1) { echo ' columns' . $columns; } ?> "> <?php foreach ($item->getChildren() as $child) { ?> <?php showItem($child, $menu); ?> <?php } ?> </ul> </div> <?php } ?> </li> <?php }
/** * Searches for an item by a key parameter * @param int The user access level * @param object Actions this user can perform * @param int * @param string The url option * @param string A timestamp */ function findKeyItem($gid, $access, $pop, $option, $now) { global $database; $keyref = stripslashes(strval(mosGetParam($_REQUEST, 'keyref', ''))); $query = "SELECT id" . "\n FROM #__content" . "\n WHERE attribs LIKE '%keyref=" . $database->getEscaped($keyref, true) . "\n%'"; $database->setQuery($query); $id = $database->loadResult(); if ($id > 0) { showItem($id, $gid, $access, $pop, $option, 0); } else { echo _KEY_NOT_FOUND; } }
function showItem(&$item, &$menu) { global $activeid; //not so elegant solution to add subtext $item->subtext = $item->getParameter('splitmenu_item_subtext', ''); if ($item->subtext == '') { $item->subtext = false; } else { $item->addLinkClass('subtext'); } ?> <li <?php if ($item->hasListItemClasses()) { ?> class="<?php echo $item->getListItemClasses(); ?> "<?php } ?> <?php if (isset($item->css_id) && $activeid) { ?> id="<?php echo $item->css_id; ?> "<?php } ?> > <?php if ($item->type == 'menuitem') { ?> <a <?php if ($item->hasLinkClasses()) { ?> class="<?php echo $item->getLinkClasses(); ?> "<?php } ?> <?php if ($item->hasLink()) { ?> href="<?php echo $item->getLink(); ?> "<?php } ?> <?php if (isset($item->target)) { ?> target="<?php echo $item->target; ?> "<?php } ?> <?php if (isset($item->onclick)) { ?> onclick="<?php echo $item->onclick; ?> "<?php } if ($item->hasLinkAttribs()) { ?> <?php echo $item->getLinkAttribs(); } ?> > <span> <?php echo $item->title; ?> <?php if (!empty($item->subtext)) { ?> <em><?php echo $item->subtext; ?> </em> <?php } ?> </span> </a> <?php } elseif ($item->type == 'separator') { ?> <span <?php if ($item->hasLinkClasses()) { ?> class="<?php echo $item->getLinkClasses(); ?> nolink"<?php } ?> > <span> <?php echo $item->title; ?> <?php if (!empty($item->subtext)) { ?> <em><?php echo $item->subtext; ?> </em> <?php } ?> </span> </span> <?php } ?> <?php if ($item->hasChildren()) { ?> <ul class="level<?php echo intval($item->level) + 2; ?> "> <?php foreach ($item->getChildren() as $child) { ?> <?php showItem($child, $menu); ?> <?php } ?> </ul> <?php } ?> </li> <?php }
/** * Searches for an item by a key parameter * @param int The user access level * @param object Actions this user can perform * @param int * @param string The url option * @param string A timestamp */ function findKeyItem($gid, $access, $pop, $option, $now) { global $database; $keyref = mosGetParam($_REQUEST, 'keyref', ''); $keyref = $database->getEscaped($keyref); $query = 'SELECT id FROM #__content WHERE attribs LIKE \'%keyref=' . $keyref . '%\' '; $database->setQuery($query); $id = $database->loadResult(); if ($id > 0) { showItem($id, $gid, $access, $pop, $option, $now); } else { echo 'Key not found ' . $keyref; } }
break; case 'edit': /* * Disabled until ACL system is implemented. When enabled the $id variable * will be passed instead of a 0 */ editWebLink(0, $option); break; case 'save': saveWebLink($option); break; case 'cancel': cancelWebLink($option); break; case 'view': showItem($id); break; default: listWeblinks($catid); break; } function listWeblinks($catid) { global $mainframe, $database, $my; global $mosConfig_live_site; global $Itemid; $rows = array(); $currentcat = null; if ($catid) { // url links info for category $query = "SELECT id, url, title, description, date, hits, params" . "\n FROM #__weblinks" . "\n WHERE catid = " . (int) $catid . "\n AND published = 1" . "\n AND archived = 0" . "\n ORDER BY ordering";
function showItem(&$item, &$menu) { global $activeid; $doc =& JFactory::getDocument(); ?> <li id="<?php echo $item->css_id; ?> "> <?php if ($item->type == 'menuitem') { ?> <a <?php if ($item->hasLinkClasses()) { ?> class="<?php echo $item->getLinkClasses(); ?> "<?php } ?> <?php if ($item->hasLink()) { ?> href="<?php echo $item->getLink(); ?> "<?php } ?> <?php if (isset($item->target)) { ?> target="<?php echo $item->target; ?> "<?php } ?> <?php if (isset($item->onclick)) { ?> onclick="<?php echo $item->onclick; ?> "<?php } if ($item->hasLinkAttribs()) { ?> <?php echo $item->getLinkAttribs(); } ?> > <span> <?php echo $item->title; ?> <?php if (!empty($item->subtext)) { ?> <em><?php echo $item->subtext; ?> </em> <?php } ?> </span> </a> <?php } elseif ($item->type == 'separator') { ?> <span <?php if ($item->hasLinkClasses()) { ?> class="<?php echo $item->getLinkClasses(); ?> nolink"<?php } ?> > <span> <?php echo $item->title; ?> <?php if (!empty($item->subtext)) { ?> <em><?php echo $item->subtext; ?> </em> <?php } ?> </span> </span> <?php } ?> <?php if ($item->hasChildren()) { ?> <ul class="level<?php echo intval($item->level) + 2; ?> "> <?php foreach ($item->getChildren() as $child) { ?> <?php showItem($child, $menu); ?> <?php } ?> </ul> <?php } ?> </li> <?php }
function showItem(&$item, &$menu) { global $activeid; ?> <li <?php if ($item->hasListItemClasses()) { ?> class="<?php echo $item->getListItemClasses(); ?> "<?php } ?> <?php if (isset($item->css_id) && $activeid) { ?> id="<?php echo $item->css_id; ?> "<?php } ?> > <?php if ($item->type == 'menuitem') { ?> <a <?php if ($item->hasLinkClasses()) { ?> class="<?php echo $item->getLinkClasses(); ?> "<?php } ?> <?php if ($item->hasLink()) { ?> href="<?php echo $item->getLink(); ?> "<?php } ?> <?php if (isset($item->target)) { ?> target="<?php echo $item->target; ?> "<?php } ?> <?php if (isset($item->onclick)) { ?> onclick="<?php echo $item->onclick; ?> "<?php } if ($item->hasLinkAttribs()) { ?> <?php echo $item->getLinkAttribs(); } ?> > <?php if (isset($item->image)) { ?> <img alt="<?php echo $item->alias; ?> " src="<?php echo $item->image; ?> "/><?php } ?> <span><?php echo $item->title; ?> </span> </a> <?php } elseif ($item->type == 'separator') { ?> <span <?php if ($item->hasLinkClasses()) { ?> class="<?php echo $item->getLinkClasses(); ?> nolink"<?php } ?> > <span><?php echo $item->title; ?> </span> </span> <?php } ?> <?php if ($item->hasChildren()) { ?> <ul class="level<?php echo intval($item->level) + 2; ?> "> <?php foreach ($item->getChildren() as $child) { ?> <?php showItem($child, $menu); ?> <?php } ?> </ul> <?php } ?> </li> <?php }
/** * Displays the main content of the page. * * @param $title The title of the page * @param $db A DB object for secure database operations */ function showContent($title, $db) { $cartID = getCartId(); $sql = "SELECT ID, name, products.price, Quantity \n FROM shoppingcarts, products \n WHERE ID=ProductID AND CartID='{$cartID}'"; $result = $db->query($sql); echo "<h1>{$title}</h1>\n"; echo "<table>\n"; showHeading(); $total = 0; while ($row = mysql_fetch_row($result)) { list($id, $prodName, $price, $qty) = $row; $total += $price * $qty; showItem($id, $prodName, $price, $qty); } $total = "\$" . number_format($total, 2); showFooter($total); echo "</table>\n"; $url = isset($_SESSION['user']) ? "true" : "false"; echo "<button onclick=\"checkout({$url})\">Checkout</button>\n"; $f = new FormLib(); ?> <p>Keep shopping</p> <form action="products.php" method="post" id="categories"> <fieldset> <legend>Select a category</legend> <table> <tr> <td class="inputcell"> <?php $list = array("All" => "", "On the Lawn" => "lawn", "Back at Camp" => "camping", "Jammin'" => "jam", "At the Lake" => "water", "Artists' CDs" => "cd"); echo $f->makeSelect('category', $list); ?> </td> </tr> </table> </fieldset> <p><input type="submit" value="Submit" /></p> </form> <?php }
switch ($task) { case 'new': editWebLink(0, $option); break; case 'edit': /** disabled until permissions system can handle it */ editWebLink(0, $option); break; case 'save': saveWebLink($option); break; case 'cancel': cancelWebLink($option); break; case 'view': showItem($id, $catid); break; default: listWeblinks($catid); break; } function listWeblinks($catid) { global $mainframe, $database, $my; global $mosConfig_shownoauth, $mosConfig_live_site, $mosConfig_absolute_path; global $cur_template, $Itemid; /* Query to retrieve all categories that belong under the web links section and that are published. */ $query = "SELECT *, COUNT(a.id) AS numlinks FROM #__categories AS cc" . "\n LEFT JOIN #__weblinks AS a ON a.catid = cc.id" . "\n WHERE a.published='1' AND a.approved='1' AND section='com_weblinks' AND cc.published='1' AND cc.access <= '{$my->gid}'" . "\n GROUP BY cc.id" . "\n ORDER BY cc.ordering"; $database->setQuery($query); $categories = $database->loadObjectList(); $rows = array();
$s = Student::findOrFail($id); // renvois une exception si l'étudiant n'existe pas. showItem($s->toArray()); } catch (ModelNotFoundException $e) { echo "Cet etudiant n'existe pas"; } } elseif (isset($_GET['showStudents'])) { // on veux afficher tous les étudiants. foreach (Student::all()->toArray() as $item) { showItem($item); echo "-----<br>"; } } elseif (isset($_GET['showGroups'])) { // on veux afficher tous les groupes. foreach (Groupe::all()->toArray() as $item) { showItem($item); echo "-----<br>"; } } elseif (isset($_GET['createStudent'])) { // on veux crer un étudiant $names = [["Alex", "Rose"], ["Art", "Rowland"], ["Barry", "Tad Keller"], ["Basil", "Abraham Lancaster"], ["Bob", "Garza"]]; $name = $names[rand(0, count($names) - 1)]; // on choisi un nom au hasard. /* * on ajoute l'étudiant dans le 1er groupe. */ Student::create(["prenom" => $name[0], "nom" => $name[1], "id_gpe" => 1]); } ?> <form method="GET">