Yahoo free web hosting - Chapter 11: Internet Resource Manager 389 sortAndDisplay() This
Chapter 11: Internet Resource Manager 389 sortAndDisplay() This method is used to sort the search result according to user s criteria. This method works as follows: . A template object is created named $menuTemplate. To load, the template file named $IRM_SEARCH_RESULT_TEMPLATE (configurable via irm.conf) is passed to the method. . This method stores the value of the session variable in an array object named $data, which is used to sort the data. . Next it checks the $cmd value, which contains sorting criteria. If $cmd is set to title , then it calls usort() with sortByResourceTitle as the function parameter to sort the search result according to resource title and checks the $sorttype value. Depending on the value of $sorttype, array_reverse() is called to reverse the sorting result. . If the $cmd is set to rating, then it calls usort() with sortByResourceRating as the function parameter to sort the result depending on the $sorttype value according to the resource rating. . If the $cmd is set to addedby, then it calls usort() with sortByResourceAddedBy as the function parameter. . Then the method registers the SESSION_SEARCH_LIST session variable and assigns the sorted result in that variable. . Next it calls the populateResource() method to show the sorted result. . Finally, the showWithTheme() method is called with the output of parsing the main block to embed with the user s theme template. displaySearResultNextandPrevious() This method is used to display the previous/next page results after executing a search operation. This method works as follows: . A template object is created named $menuTemplate. To load, the template file named $IRM_SEARCH_RESULT_TEMPLATE (configurable via irm.conf) is passed to the method. . Now it checks the $cmd value. If it is set to next , then it generates the next page resource starting point. If $cmd is set to previousBlock , then it generates the previous page starting point. . Next it calls the populateResource() method to show the sorted result. . Finally, the showWithTheme() method is called with the output of parsing the main HTML template block to embed with the user s theme template.