Archive for December, 2007

392 Part II: Developing Intranet Solutions . Your (Web design rates)

Wednesday, December 26th, 2007

392 Part II: Developing Intranet Solutions . Your intranet Web server document root directory is /evoknow/intranet/ htdocs. Of course, if you have a different path, which is likely, you should change this path whenever you see it in a configuration file or instruction in this chapter. During the installation process, I will refer to this directory as %DocumentRoot%. . Finally I also assume that You have installed the PHPLIB and PEAR library. Normally, these gets installed during PHP installation. For your convenience, I have provided these in the lib/phplib.tar.gz and lib/pear.tar.gz directories on the CD-ROM. In these sample installation steps, we will assume that these are installed in the /%DocumentRoot%/phplib and /%DocumentRoot%/pear directories. Because your installation locations for these libraries are likely to differ, make sure you replace these paths in the configuration files. Here is how you can get your IRM applications up and running: . Install Base Intranet Applications. If you haven t yet installed the base intranet user home application and the messaging system discussed in Chapter 7, you must do so before proceeding further. . Install Intranet Calendar Database Tables. I make the assumption that you have already installed the INTRANET database (see Chapter 7 for details). You need to install the ch11/sql/irm.sql database. The quickest way to create the database is to run the following commands: mysqladmin u root p create IRM mysql u root p D IRM < irm.sql . Install IRM Applications. Now from the ch11 directory on the CD-ROM, extract ch11.tar.gz in %DocuemntRoot%. This will create irm in your document root. Configure %DocumentRoot%/irm/apps/irm.conf for path and database settings. The applications are installed in the %DocumentRoot%/ irm/apps directory and the templates are stored in %DocumentRoot%/irm/ apps/templates. Your MySQL server is hosted on the intranet Web server and, therefore, it can be accessed via localhost. However, if this is not the case, you can easily modify the database URLs in each application s configuration files. For example, the home.conf file has a MySQL database access URLs such as the following: $INTRA_DB_URL = mysql://root:foobar@localhost/INTRANET ; $IRM_DB_URL = mysql://root:foobar@localhost/CALENDAR ; $APP_DB_URL = mysql://root:foobar@localhost/auth ;

Photoshop web design - Chapter 11: Internet Resource Manager 391 . It

Tuesday, December 25th, 2007

Chapter 11: Internet Resource Manager 391 . It creates a theme template object called $themeTemplate. . The user s theme template is loaded into the $themeTemplate object. . This method is called with a parameter called $output, which will be shown with the theme template. This $output is set into in the CONTENT_BLOCK block. . Then it parses all the blocks and shows the final output. authorize() This method authorizes everyone on the intranet to view the resource manager and, therefore, always returns TRUE. sortByResourceTitle() This method is used to sort resources by their titles according to alphabetical order. It takes two arrays as inputs and compares their RESOURCE_TITLE element using the strcmp() method. sortByResourceAddedBy() This method is used to sort resources by its creator name according to alphabetical order. It takes two arrays as input and compares their RESOURCE_ADDED_BY element using the strcmp() method. sortByResourceRating() This method is used to sort resources by their rating. It takes two arrays as input and compares their RESOURCE_RATING element. If the first array s resource rating is greater than the second one then it returns 1; if they are equal, it returns 0; otherwise, it returns 1. sortByResourceVisitor() This method is used to sort resources by their visitor numbers. It takes two arrays as input and compares them. If the first array s visitor number is greater than the second one, then it returns 1; if they are equal, then it returns 0; otherwise, it returns 1. Installing an IRM on Your Intranet Here we will assume that you re using a Linux system with MySQL and Apache server installed. The following installation process assumes the following:

Web site development - 390 Part II: Developing Intranet Solutions showTopRankingResource() This

Tuesday, December 25th, 2007

390 Part II: Developing Intranet Solutions showTopRankingResource() This method is used to display the top-ranked resources. It 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. . Next it registers the session variables SESSION_SEARCH_LIST and SESSION_PAGE_SIZE to store the search output and number of resources that needs to be shown each page, respectively. . Then it creates a Resource class object named $resourceObj and calls the getTopRankingList() method with the defined variable TOPRANKING (which is configurable in the irm.conf) to get the top-ranking resource. . It creates a User class object named $userObj and calls getUserInfo() method to get the name of the user who added the resource. . It sets the result and parses the main block. Then it calls the showWithTheme() method to embed the output with the user s theme template. showMostVisitedResource() This method is used to display the most visited resources. It 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. . Next it registers the session variables SESSION_SEARCH_LIST and SESSION_PAGE_SIZE to store the search output and number of resources to be shown in each page, respectively. . Then It creates an object of Resource class named $resourceObj and calls the getMostVisitedResource() method with a arameter called MOSTVISITED, which specifies the number of the most visited resource to be shown (configurable in the irm.conf). . It calls the getResourceInfo() method to get information for each resource and stores in the session variable SESSION_SEARCH_LIST and displays the search result. . Finally the showWithTheme() method is called with the output of parsing the main block to embed with the user s theme template. showWithTheme() This method is use to show the user s theme template. It works as follows:

Yahoo free web hosting - Chapter 11: Internet Resource Manager 389 sortAndDisplay() This

Tuesday, December 25th, 2007

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.

388 Part II: Developing (Web hosting packages) Intranet Solutions . A

Monday, December 24th, 2007

388 Part II: Developing Intranet Solutions . A template object is created named $menuTemplate. To load, the template file named $IRM_SEARCH_TEMPLATE (configurable via irm.conf) is passed to the method. . It creates an object of the Category class named $catObj and shows the category and subcategory names with the number of resources belonging to respective categories. . Then It calls the populateCategory() method to show the category list in the drop-down list in the template. . It creates an object of the User class named $userObj and calls the getUserList() method to populate all the user lists. . Next it checks whether the viewer is an administrator of the IRM application or not. If she is not an administrator, it gives only the add resource link. On the other hand, If she is an administrator, it gives the category and resource manager link along with the add resource. . Finally, the showWithTheme() method is called with the output of parsing the main block to embed with the user s theme template. displaySearchResult() This method is used to display the results after executing a search operation. It 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. . Then it creates a Resource class object named $resourceObj and calls the searchResource() method with the search criteria given by the user and stores it in the array named $resourceList. . It creates a User class object named $userObj and calls the getUserInfo() method to get the name of the user who added the resource. . Next, it assigns the search result in the SESSION_SEARCH_LIST session variable and assigns the value in the SESSION_PAGE_SIZE session variable if it is given by the user from the search interface. If it is not given by the user, then it assigns the default value (DEFAULT_PAGE_SIZE), which is configurable via irm.conf. . Then It calls the populateResource() method to show the search result. . Finally, the showWithTheme() method is called with the output of parsing the main block to embed with the user s theme template.

How to cite a web site - Chapter 11: Internet Resource Manager 387 . If

Monday, December 24th, 2007

Chapter 11: Internet Resource Manager 387 . If the category list is not empty, then it sets the category ID and name for each category in the list; otherwise, it returns null. . If $blockName is set to jsblock, then it parses the jsCategoryBlock and sets the output into the $category variable. Otherwise, it parses the categoryBlock block if the category ID is not equal to the $selectValue and sets the output in the $category variable. . Finally, this method returns the value of $category variable. populateSubCategory() This method is used to populate the subcategory list for the given category. It works as follows: . This method is called with the template name ($template), category ID ($cat_id), and block name ($blockName), where the subcategory will be populated. . A new object of the Category class is created named $subcatagoryObj, and the getSubCategoryList() method is called from the class with the given category ID ($cat_id) as a parameter. The subcategory list is then stored in the array named $subcategoryList. . If the subcategory list is not there, then it checks the given block name. Then it sets the subcategory name and ID in respective variables in the given block and sets the output in the $subCategory variable parsing the block. . Finally, this method returns the subcategory list stored in the $subCategory. populateResource() This method is used to display resources to show the search result. It works as follows: . This method is called with a template name ($template), resource display starting point ($startingPoint), and block name ($blockName) where the resource information is displayed. . Next it sets the resource information in the template. . Then It sets the alternative different colors in rows to display, parses each row, and stores it in the $resource variable. . Finally, it returns the value of $resource. showMenu() This method is used to display the menu shown in the search index page. It works as follows:

386 Part II: Developing Intranet Solutions authorize() This (Frontpage web hosting)

Sunday, December 23rd, 2007

386 Part II: Developing Intranet Solutions authorize() This method authorizes everyone on the intranet to view the resource manager and, therefore, always returns TRUE. Creating a Search Manager Application This application, irm_search_mngr.php, is responsible for managing search operations. This application is included on the CD-ROM in the ch11/apps directory. This application has the following methods. run() When the application is run, this method is called. It does the following: . It creates a theme object, $this->themeObj. . The current user s theme choice is stored in $this->theme by calling the getUserTheme() method of the theme object created. . Next, if the query parameter $cmd is set to search, it calls the displaySearchResult() method; if $cmd is set to previous or next, then it calls displaySearResultNextandPrevious(); if it is set to mostvisited, then it calls showMostVisitedResource() to show the most visited resources; if it is set to topranking, then it calls showTopRankingResource() to show the top-ranking resources; if the $cmd is set to title, rating, or addedby, then it calls sortAndDisplay(); and if $cmd is set to nothing then it calls showMenu(). In other words, the run() method decides which functionality is requested by the user and calls the appropriate driver method to perform the desired operations. populateCategory() This method is used to populate the list of all available main categories. It works as follows: . This method is called with the template name ($template), the block name ($blockName), and the default selected value ($selectValue). . A new Category object called $categoryObj is created and the getCategoryList() method of that object is called to generate the available main categories name and stored in an array named $categoryList.

Chapter 11: Internet Resource Manager 385 . It (Freelance web design)

Sunday, December 23rd, 2007

Chapter 11: Internet Resource Manager 385 . It creates a theme template object called $themeTemplate. . The user s theme template is loaded into the $themeTemplate object. . This method is called with a parameter called $output, which will be shown with the theme template. This $output is set into in the CONTENT_BLOCK block. . Then it parses all the blocks and shows the final output. authorize() This method authorizes everyone on the intranet to view the resource manager and, therefore, always returns TRUE. Creating a Resource Tracking Application This application, irm_resource_track_mngr.php, is responsible for resources tracking. This application is included on the CD-ROM in the ch11/apps directory. The application has the following methods. run() This method is responsible for running the application. First it sets the user ID into a variable named $uid. Then it calls the keepTrack() method. keepTrack() This method keeps track of resource visits and updates the database. It works as follows: . First it defines an array named $params containing the resource ID, visitor ID (user ID), and current time. . Then it creates an object of Resource class and calls the trackResourceVisit() method with the $params array to insert records in the RESOURCE_VISITOR table. . If it successfully inserts the data, then it calls the getResourceUrl() method to get the URL of the resource. . Finally, it redirects the page to the resource URL.

384 Part II: Developing Intranet Solutions . Then (Web design seattle)

Saturday, December 22nd, 2007

384 Part II: Developing Intranet Solutions . Then it creates an object of Resource class and calls deleteKeywords() with the selected resource ID as a parameter. . If it successfully deletes the keywords, then it calls the deleteResource() method to delete the resource information from the RESOURCE table. . Finally, it calls the displayWithTheme() method to show the status message of deletion with the user s theme. displayDescription() This method is used to display the description of the given resource. It works as follows: . A template object is created named $menuTemplate. This method then loads the $IRM_RESOURCE_DES_TEMPLATE template. . Then It creates an object of Resource class and calls getResourceInfo() with the selected resource ID as a parameter, which returns the resource information. . Next it sets the title and description in the template. . Finally, it parses the main block and calls the displayWithTheme() method to show output with the user s theme. selectResource() This method is used to give the user an option to choose a resource for modification. The method works as follows: . First, the method creates an object of Category class named $catObj. . Next it populates the main category by calling the populateCategory() method. . If the $category is assigned any value, then it finds the subcategory list by calling the getSubCategoryList(). . Then It checks whether the variable $change is assigned any value or not. If $change has any value, then it generates the resource list according to the main category or the subcategory changes. . Finally the showWithTheme() method is called with the output of parsing the main block to embed the message with the user theme template. displayWithTheme() This method is used to show the user s theme template. It works as follows:

Chapter 11: Internet (Web hosting reviews) Resource Manager 383 . Then

Saturday, December 22nd, 2007

Chapter 11: Internet Resource Manager 383 . Then an object of Resource class is created named $resourceObj. It calls getResourceInfo() with the resource ID to get the information about the selected resource and calls getKeywords() to get keywords for the resource. . Next it sets the resource information in the template. . It calls populateCategory() to generate the category list. . Finally, the showWithTheme() method is called with the output of parsing the main block to embed the message with the user theme template. modifyResource() This method updates modified resource information to the database. It works as follows: . First, this method checks whether the category is provided. If the category is not provided, then it gives an error message and returns null. . Next, the method checks whether the resource name and URL is given. If the resource name is not given, then an error message is shown and it returns null. . Then It checks the validity of a given URL. If the URL is not valid, then it shows the appropriate error message to the user ( incorrect URL given ) and returns from the method. . If a new category name is provided by the user of his own, then it checks whether the category already exists. If it doesn t exist, then it adds the new category in the CATEGORY table. . Then It creates an object of Resource class and calls the modifyResource() method with the proper parameter to resource in the RESOURCE table. If it successfully modifies the resource, then it returns the resource ID. If it fails to modify, then a message is shown that the resource is not modified. . If the resource is modified successfully, then it deletes all the previous keywords and adds new keywords in the RESOURCE_KEYWORD table. . Finally, it calls the displayWithTheme() method to show the message with the user s theme. delete() This method deletes resource information. It works as follows: . This method first checks whether any resource is selected to delete or not. If it is not given, then an error message is shown and returns null.