Advanced Directory

The Advanvced Directory Profile scripts create the directory grid as well as the profile page with one single page creation.  Additionally, there are options available to the user with respect to how the directory is output.  All information that is output comes from CampusWebData and BASIS.  See our Directory Updates page for instructions on updating profiles in CampusWebData.

  • Allows for any number of API calls
  • Requires users to count API calls and set the variable, $_SESSION['uark_total_number_api_calls'], to the number of API calls that are being made on that page
  • Allows for any HTML content to appear on the directory page
  • All maintenance of the code for this method has to be done on the source view side, and if any HTML content is required, the content author will need to break in and out of PHP
  • Can use any template that is available, except for interior-directory template,

Using the Advanced Method

  1. Login to OMNI CMS where the directory page needs to be created or edited.
  2. For a new page, click the "+New button" or click on the "+New dropdown" to the right of the button and select any template, except for interior-directory.  For this example, I will choose the ‘New Interior Page’ template.
  3. Once that template is selected, the New Interior Page wizard will show. Fill out all of the fields that are necessary.  Once this page is created, you will need to go to the Directory API Builder page in order to obtain a properly formatted API URL that will generate the directory grid.
  4. Then, in the OU CMS, click on the ‘Source’ button, of which will then reveal the source code. Please access/download the code block example, which is a sample block of code that can be copied, pasted, and then modified to create the desired output. 

Note that for any text/HTML that needs to appear on ONLY the directory page, you will have to break in and out of PHP after matching the URL path for the profile page.

The above items are present in the aforementioned code block example.  Copy all of this text from this file and paste it into the <maincontent> node in the source code view editor of the page that is being created.

In order for this page to work there are a few lines of code that are absolutely necessary (or else the code will break), of which are:

  1. Opening and closing div: <div class="ou-profile-directory"> … PHP code … </div>
  2. Path and requirement for the PHP function: require ( "/www/vhosts/www.uark.edu/_resources/php/directory-api.php");
  3. Actual link variable: $actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
  4. At least one function/API call, for example: CampusDataDirectory::displayDirectoryProfilePages('https://campusdata.uark.edu/apiv2/people/listFS?$filter=((Uid+eq+%27kbrye%27)+or+(Uid+eq+%27zmoon%27)+or+(Uid+eq+%27llnalley%27)+or+(Uid+eq+%27jhpopp%27)+or+(Uid+eq+%27crom%27)+or+(Uid+eq+%27msavin%27)+or+(Uid+eq+%27jts004%27)+or+(Uid+eq+%27sharpley%27)+or+(Uid+eq+%27cshoulde%27))&amp;$orderby=lastName+asc','entire','Test Intro Text','479-575-2000','img-default','glbl-no-photo.jpg');
  5. The variable, $_SESSION['uark_total_number_api_calls'], needs to be set to the correct number of API calls that are occurring on the page. Failure to do so will make it such that profiles occurring after the 2nd API call (because the code block example has this variable set to 2) will not be displayed on the profile page when clicked on from the grid page;

With respect to updating/managing the PHP function call, below are the parameters the function accepts and what they control:

1st parameter

An example of the API URL that should be copied and pasted from the ‘copy API only’ field on the Build Directory API page.

(https://campusdata.uark.edu/apiv2/people/listFS?$filter=((Uid+eq+%27kbrye%27)+or+(Uid+eq+%27zmoon%27)+or+(Uid+eq+%27llnalley%27)+or+(Uid+eq+%27jhpopp%27)+or+(Uid+eq+%27crom%27)+or+(Uid+eq+%27msavin%27)+or+(Uid+eq+%27jts004%27)+or+(Uid+eq+%27sharpley%27)+or+(Uid+eq+%27cshoulde%27))&amp;$orderby=lastName+asc)

2nd parameter (entire)

This is the directory grid continuity switch, which allows you to create an entire grid, start a grid, continue a grid, or end a grid with each API call. This flexibility allows you to create a top row for leadership that may be one or two profiles , but then show the rest of the staff in the standard 4 profile pics per row (in desktop view).  The only available parameters that will be accepted and their functions are as follows (the parameter that should be entered is the text on the left occurring before the dash):

  1. entire – encloses the grid in both an opening and closing div
  2. start – starts a new grid with just the opening div
  3. continue – continues a current grid and has no opening or closing divs
  4. end – closes off the grid with a closing div

IMPORTANT: If the grid display looks broken, be sure to double-check the above four parameters and ensure that they are the correct ones for the use case directory grid needs at hand.

3rd parameter (Test Intro Text)

This parameter accepts text strings or no value at all and will be output as introductory text that will appear on the directory page before the directory grid. The text entered here should not contain any HTML, and will be output and enclosed in <p> tags.  Otherwise, if no value is passed, there will be no text.  Alternatively, as mentioned above in step 6, HTML/text that needs to be output on the directory page can be put in the section whereby PHP does the check of the URL pattern to determine if it is a directory page, whereby PHP breaks out and whereby the HTML/text can be entered as regular inline HTML code.

4th parameter (479-575-2000)

This parameter can be blank or accepts a phone number in the format of 479-575-2000 and represents the phone number that will be displayed for the cases whereby a profile doesn’t have a phone number set in BASIS. The aforementioned number is the number for Campus Directory Assistance. Leaving this field blank will remove the phone number field on both the directory grid page as well as the profile page from any person who doesn't have a phone number listed in BASIS.

5th parameter (img-default)

This parameter accepts any of the following three as a dropdown and controls the type of shape of the photos on the directory page (the parameter that should be entered is the text on the left occurring before the dash):

  1. img-default – image will be portrait shaped
  2. img-square – image will be square shaped
  3. img-circle – image will be circle shaped

6th parameter (glbl-no-photo.jpg)

This parameter ONLY accepts strings that are available on the Directory API Variables dropdown for Directory API No Photo field that appears in the New Interior Page form wizard (Basic Method), and controls what the default image is for any profile that doesn’t have a picture in CampusWebData. A user can see what the actual image is by appending the dropdown value to the URL, https://campusdata.uark.edu/resources/images/FacultyStaffProfile/, and viewing that address/picture in a web browser, e.g., https://campusdata.uark.edu/resources/images/FacultyStaffProfile/glbl-no-photo.jpg  Available and accepted values are:

  • nophoto2.png
  • glbl-no-photo.jpg
  • afls-no-photo.png
  • arch-no-photo.png
  • arsc-no-photo.png
  • educ-no-photo.png
  • engr-no-photo.jpg
  • grad-no-photo.jpg
  • hono-no-photo.jpg
  • lawd-no-photo.jpg
  • no-photo.jpg
  • walt-no-photo.jpg

Once all of the information has been updated in the code block, save, publish and view the page.

If a content author needs to update any of information that appears on this page, this can be done by opening the page in the OU CMS, making sure it is checked out (the lightbulb will be ‘on’) and then click EditàSource, whereby the source code can be updated. After making the updates, click the ‘Save’ button and then publish to see the updated page.  At this point the browser cache may need to be flushed to see the new update.  (See http://www.refreshyourcache.com/en/home/ on how to flush browser cache.)

Caching

Finally, be aware that the server is actually caching directory pages for a quicker load time, so this means that a change in CampusWebData will likely not be reflected on the directory/profile pages for 30 minutes. Here is a manual way in which the server will flush its cache upon request, which should then reflect any newly made updates in CampusWebData.

Flush directory page cache – append ?rebuild to the end of the URL eg. http://examples.uark.edu/directory/untitled.php?rebuild

To disable the link to profile pages per API call, add the showprofile=false& in the same location as you see below, per call.

https://campusdata.uark.edu/apiv2/people/listFS?showprofile=false&amp;$filter=((BudgetaryUnit+eq+%27UREL%27))&amp;amp;$orderby=firstName+asc