# We give the user the power of sorting the list of tutorials to their # taste. We need to get that information and provide some default # choices in case no information is provided, or it is faulty. $sortBy = isset($_GET["sort"]) ? strtolower($_GET["sort"]) : "uploaded"; if ((strpos("-title-size-author-uploaded-resolution-", "-$sortBy-") === false) || (strpos($sortBy, "-") !== false)) $sortBy = "uploaded"; $sortOrder = isset($_GET["order"]) ? strtolower($_GET["order"]) : ""; if ((strpos("-asc-desc-", "-$sortOrder-") === false) || (strpos($sortOrder, "-") !== false)) $sortOrder = ""; if ($sortOrder == "") { $sortOrder = "asc"; if ($sortBy == "uploaded") $sortOrder = "desc"; } $script = $_SERVER["PHP_SELF"]; # Output the beginning of the page. ?>
Wink is a free software package available to PowerPro users, offering the means to record visual demonstrations of features of their PowerPro configuration in order to share with other members of the PowerPro community.
Click a column header to sort the table by a particular attribute.
# Check that the tutorial data file is accessible, and if so, load its # information into an array. if ($dataHandle = @fopen("tutorial_data.txt", "r")) { while(($url = fgets($dataHandle)) !== false) { $data[] = array(trim(fgets($dataHandle)), filesize(trim($url)), trim(fgets($dataHandle)), trim(fgets($dataHandle)), trim(fgets($dataHandle))); } # Sort the array according to the specified or default sort criteria. function sort_by_column($a, $b) { global $data, $sortBy, $sortOrder; if ($sortBy == "title") { if (strtolower($data[$a][0]) == strtolower($data[$b][0])) return 0; if ($sortOrder == "asc") return (strtolower($data[$a][0]) > strtolower($data[$b][0]) ? 1 : -1); return (strtolower($data[$a][0]) > strtolower($data[$b][0]) ? -1 : 1); } if ($sortBy == "size") { if ($data[$a][1] == $data[$b][1]) return 0; if ($sortOrder == "asc") return ($data[$a][1] > $data[$b][1] ? 1 : -1); return ($data[$a][1] > $data[$b][1] ? -1 : 1); } if ($sortBy == "author") { if (strtolower($data[$a][2]) == strtolower($data[$b][2])) { # secondary sort by descending date of upload if ($data[$a][3] == $data[$b][3]) { # tertiary sort by ascending title if ($data[$a][0] == $data[$b][0]) return 0; return (strtolower($data[$a][0]) > strtolower($data[$b][0]) ? 1 : -1); } return (strtolower($data[$a][3]) > strtolower($data[$b][3]) ? -1 : 1); } if ($sortOrder == "asc") return (strtolower($data[$a][2]) > strtolower($data[$b][2]) ? 1 : -1); return (strtolower($data[$a][2]) > strtolower($data[$b][2]) ? -1 : 1); } if ($sortBy == "uploaded") { if ($data[$a][3] == $data[$b][3]) { # secondart sort by ascending title if ($data[$a][0] == $data[$b][0]) return 0; return ($data[$a][0] > $data[$b][0] ? 1 : -1); } if ($sortOrder == "asc") return ($data[$a][3] > $data[$b][3] ? 1 : -1); return ($data[$a][3] > $data[$b][3] ? -1 : 1); } if ($sortBy == "resolution") { if ($data[$a][4] == $data[$b][4]) { # secondary sort by descending date of upload if ($data[$a][3] == $data[$b][3]) { # tertiary sort by ascending title if ($data[$a][0] == $data[$b][0]) return 0; return ($data[$a][0] > $data[$b][0] ? 1 : -1); } return ($data[$a][3] > $data[$b][3] ? -1 : 1); } if ($sortOrder == "asc") return ($data[$a][4] > $data[$b][4] ? 1 : -1); return ($data[$a][4] > $data[$b][4] ? -1 : 1); } } uksort($data, "sort_by_column"); # Close the file. fclose($dataHandle); # Output the table. ?>1 KB | // | �0 | Play / Full Screen |
Failed to open the tutorial data file. Cannot display the table.
"; } ?>If you would like to develop your own Winks (flash tutorials) for PowerPro, here are some build suggestions to keep in mind:
Special thanks to Suleyman Kesir for introducing PowerPro's Yahoo! Group audience to Wink; to David Troesch for hosting this service and to Alex Peters for programming the web interface.