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 b
Trang 1◆ It creates a theme template object called $themeTemplate.
◆ The user’s theme template is loaded into the $themeTemplateobject
◆ This method is called with a parameter called $output, which will
be shown with the theme template This $outputis 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_TITLEelement 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; oth-erwise, 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:
Trang 2◆ 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 PHPLIBand PEARlibrary Normally, these gets installed during PHP installation For your convenience,
I have provided these in the lib/phplib.tar.gzand lib/pear.tar.gz
directories on the CD-ROM In these sample installation steps, we will assume that these are installed in the /%DocumentRoot%/phpliband
/%DocumentRoot%/peardirectories 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 INTRANETdatabase (see Chapter 7 for details) You need to install the ch11/sql/irm.sqldatabase 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 ch11directory on the CD-ROM, extract ch11.tar.gzin %DocuemntRoot% This will create irmin your document root Configure %DocumentRoot%/irm/apps/irm.conffor path and database settings The applications are installed in the %DocumentRoot%/ irm/appsdirectory 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.conffile 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’;
Trang 3Say your database server is called db.domain.comand the user name and password to access the INTRANETand authdatabases (which you will create during this installation process) are adminand db123 In such a case, you would modify the database access URLs throughout each configuration file
as follows:
$INTRA_DB_URL = ‘mysql://admin:db123@db.domain.com/INTRANET’;
$IRM_DB_URL = ‘mysql://admin:db123@db.domain.com/IRM’;
$APP_DB_URL = ‘mysql://admin:db123@db.domain.com/auth’;
◆ Add IRM to the Theme Navigation Bar You need to update your theme
navigation bar files stored in %DocumentRoot%/themes/%theme%/
home_left_nav.html, whenever you add a new application For example,
to update the std_bluetheme, you need to update the %DocumentRoot%/
themes/std_blue/home_left_nav.htmlfile to include the following line
in the HTML table:
<tr><td width=”100%”><font size=2><a href=”/irm/apps/
irm_search_mngr.php”>IRM</a></font></td> </tr>
This will create a new row in the left navigation bar created with the HTML table
◆ Set File/Directory Permissions Make sure you have changed file and
directory permissions such that your intranet Web server can access all the files
After you’ve performed the preceding steps, you’re ready to test your IRM applications
Testing IRM
Log in to your intranet via http://yourserver/index.phpor http://yourserver/
home/home.php Click on the Calendar link on the left navigation bar of your intranet home page,
or point your Web browser to http://yourserver/irm/apps/irm_search_mngr.
phpafter you’re logged in to the intranet
This will show you the IRM search interface as shown in Figure 11-3
You will notice that there are no resources set up, because we haven’t yet set up categories
To set up categories, click on the Category Manager as an administrative user
You will see a screen similar to Figure 11-4
Trang 4Figure 11-3: The IRM search interface.
Figure 11-4: The Category Manager.
Trang 5Click on the Add Category button and you will see a screen similar to Figure 11-5.
Figure 11-5: Adding a new category.
Enter a new category name If this is a subcategory of an existing category, select the parent category from the available categories Finally, click on the Add Category button to add the new category
As mentioned in the functionality requirements, the Internet resources are only added in subcategories There can be only one-level subcategories for each main category So you should add at least one subcategory per main category Figure 11-6 shows a new category called Languages with the PHP subcategory
Keep adding categories and subcategories as you need Figure 11-7 shows a list
of categories with subcategories that we’ve created for this test