//display other static page echo "<li><a style=\"padding-left:1.45em;\" href=\"" . ROOT_URL . "view_page.php?page_wk=2\">About Us</a></li>"; // Guest Only Pages if (!$session->is_logged_in) { echo "<li><a href=\"login.php\">Login</a></li>"; } else { // all logged in users echo "<li class=\"dropdown\"><a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\"> Users <i class=\"icon-angle-down\"></i></a><ul class=\"dropdown-menu\">"; echo "<li><a style=\"padding-left:1.45em;\" href=\"" . ROOT_URL . "user/manage_watch_lists.php\">Watch Lists</a></li>"; echo "<li><a style=\"padding-left:1.45em;\" href=\"" . ROOT_URL . "user/wish_list.php\">Wish List</a></li>"; echo "<li><a style=\"padding-left:1.45em;\" href=\"" . ROOT_URL . "user/delete_user.php\">Delete my Account</a></li>"; echo "<li><a style=\"padding-left:1.45em;\" href=\"" . ROOT_URL . "user/update_user.php\">Update my Account</a></li>"; echo "<li><a style=\"padding-left:1.45em;\" href=\"" . ROOT_URL . "user/logout.php\">Logout</a></li>"; echo "</ul></li>"; // Admin and Staff Only Pages if (is_admin_or_staff()) { echo "<li class=\"dropdown\"><a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\"> Admin/Staff <i class=\"icon-angle-down\"></i></a><ul class=\"dropdown-menu\">"; echo "<li><a style=\"padding-left:1.45em;\" href=\"" . ROOT_URL . "admin/create_page.php\">Add a New Page</a></li>"; echo "<li><a style=\"padding-left:1.45em;\" href=\"" . ROOT_URL . "admin/add_pet.php\">Add a New Pet</a></li>"; echo "<li><a style=\"padding-left:1.45em;\" href=\"" . ROOT_URL . "admin/manage_breeds.php\">Manage Breeds and Types</a></li>"; echo "<li><a style=\"padding-left:1.45em;\" href=\"" . ROOT_URL . "admin/manage_colors.php\">Manage Colors</a></li>"; echo "<li><a style=\"padding-left:1.45em;\" href=\"" . ROOT_URL . "admin/manage_pet_status.php\">Manage Pet Status</a></li>"; echo "<li><a style=\"padding-left:1.45em;\" href=\"" . ROOT_URL . "admin/manage_vaccinations.php\">Manage Vaccinations</a></li>"; echo "<li><a style=\"padding-left:1.45em;\" href=\"" . ROOT_URL . "admin/manage_website_settings.php\">Manage Web Site Settings</a></li>"; echo "<li><a style=\"padding-left:1.45em;\" href=\"" . ROOT_URL . "admin/report.php\">Report</a></li>"; echo "<li><a style=\"padding-left:1.45em;\" href=\"" . ROOT_URL . "admin/search_users.php\">Search Users</a></li>"; echo "</ul></li>"; } if (isset($session->user_wk)) { $user = User::find_by_id($session->user_wk); echo "<li><a style=\"padding-left:1.45em; color:#2ecc71;\"> " . $user->username . " </a></li>";
function display_pet_blog($sql, $is_folder = false) { global $database; global $session; $return = ""; //get all the pets $pets = Pet::find_by_sql($sql); //get all the wish list items //only do this if the user is logged in if ($session->is_logged_in) { $sql = "SELECT * FROM `pet_wish_list` WHERE `user_wk` = " . $session->user_wk . ";"; $pwl = Pet_Wish_List::find_by_sql($sql); } else { $pwl = array(); } // loop through all of the pet wish list elements (if any) and get their wk's $wish_array = array(); foreach ($pwl as $wish_elem) { $wish_array[] = $wish_elem->pet_wk->pet_wk; } //only display the table with results if //there are more than 0 pets if (count($pets) > 0) { //there are pets to display $return = "<div>\n\t\t\t\t\t\t\t\tSort by: <a href=\"" . file_name_without_get() . "?toggle=name\">Name</a> | \n\t\t\t\t\t\t\t\t<a href=\"" . file_name_without_get() . "?toggle=pet_type\">Pet Type</a> | \t\t\n\t\t\t\t\t\t\t\t<a href=\"" . file_name_without_get() . "?toggle=breed\">Breed</a> | \n\t\t\t\t\t\t\t\t<a href=\"" . file_name_without_get() . "?toggle=color\">Color</a> | \n\t\t\t\t\t\t\t\t<a href=\"" . file_name_without_get() . "?toggle=status\">Status</a> | \n\t\t\t\t\t\t\t\t<a href=\"" . file_name_without_get() . "?toggle=age\">Age</a> | \n\t\t\t\t\t\t\t\t<a href=\"" . file_name_without_get() . "?toggle=weight\">Weight</a> | \n\t\t\t\t\t\t\t <a href=\"" . file_name_without_get() . "?toggle=date_added\">Date Added</a> | "; //if you're an admin or staff, display the ability to //immediately update the pet if (is_admin_or_staff()) { //$return .= "Update"; } $return .= "</div><br><br>"; //loop through all pets $rowCutter = 0; $return .= "<section class=\"blog\" style=\"width:100%\"><div class=\"row\">"; foreach ($pets as $value) { $value->get_my_comments(); $return .= "\t<div class=\""; if (is_mobile()) { $return .= "col-xs-11"; } else { $return .= "col-xs-6"; } $return .= "\">\n\t\t\t\t\t\t\t<div id=\"" . $value . "_row\" class=\"blog-item\">\n\t\t\t\t\t\t\t\t<a href=\"" . ROOT_URL . "view_pet.php?pet_wk=" . $value->pet_wk . "\"><img class=\"img-responsive img-blog\" src=\""; if ($is_folder) { $return .= "../"; } $return .= "uploads/" . $value->image_wk->filename . "\" ></a>\n\t\t\t\t\t\t\t\t<div class=\"blog-content\">\n\t\t\t\t\t\t\t\t<div class=\"entry-meta\">\n\t\t\t\t\t\t\t\t<span><i class=\"icon-calendar\"> " . date("m/d/Y h:i A", strtotime($value->create_dt)) . "</i><span>\n\t\t\t\t\t\t\t\t<span> <i class=\"icon-comment\"> " . count($value->comment) . "</i><span>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<h3><a href=\"" . ROOT_URL . "view_pet.php?pet_wk=" . $value->pet_wk . "\">" . $value->name . "</a></h3>\n\t\t\t\t\t\t\t\tPet Type: " . $value->breed_wk->pet_type_wk->name . "\t\n\t\t\t\t\t\t\t\t<br>Pet Breed: " . $value->breed_wk->name . "\n\t\t\t\t\t\t\t\t<br>Pet Color: " . $value->color_wk->name . "\n\t\t\t\t\t\t\t\t<br>Pet Status: " . $value->status_wk->name . "\t\t\n\t\t\t\t\t\t\t\t<br>Pet Age: " . $value->age . "\n\t\t\t\t\t\t\t\t<br>Pet Weight: " . $value->weight . "<br>"; // quick option to add/remove pet from wish list if ($session->is_logged_in) { if (in_array($value->pet_wk, $wish_array)) { $return .= "<br><input id=\"" . $value->pet_wk . "\" type=\"button\" class=\"btn btn-success btn-md btn-block\" onclick=\"wish_list(" . $value->pet_wk . ", this.id)\" value=\"Remove from Wish List\" />"; } else { $return .= "<br><input id=\"" . $value->pet_wk . "\" type=\"button\" class=\"btn btn-success btn-md btn-block\" onclick=\"wish_list(" . $value->pet_wk . ", this.id)\" value=\"Add to Wish List!\" />"; } } //if you're an admin or staff, display the ability to //immediately update the pet if (is_admin_or_staff()) { $return .= "<a href=\"" . ROOT_URL . "admin/update_pet.php?pet_wk=" . $value->pet_wk . "\" class=\"btn btn-success btn-md btn-block\">Update</a>"; } $return .= "</div></div></div>"; $rowCutter++; //end current row and start new - visually if content = 2 if (is_mobile()) { $mod_by = 1; } else { $mod_by = 2; } if ($rowCutter % $mod_by == 0) { $return .= "</div><div class=\"row\">"; } } $return .= "</div>"; } $return .= "<p><em>Your search returned " . count($pets) . " pet(s).</em></p>"; $return .= "</section>"; return $return; }