Proper documentation... elseif statements

Day Two:

Morning:

Email, email, email, email.

Taught dad how to use Google Docs, and Google Groups. Spent the rest of the morning reading through the handbooks of the MUFA Librarians, MUFA, and University of Ottawa regarding the policies on Academic Freedom and Grievances so that maybe one day we can have sane policies.

Afternoon:

Email, email, email, email.

More consulting on journals in our IR. Working with Text Technology to get all of their back issues digitized. Met with the editors of the Northrop Frye journal regarding a mock-up for their site in the IR. There was a time when I worked closely with an amazing Scholarly Communications librarian with all the IR stuff. Meh, so much for that r-word.

Cleaned up a bunch of CSS on the Historical Perspectives on Canadian Publishing site. Waiting for the results of Amanda’s usability analysis of the site to make further changes.

Spent the remainder of the afternoon writing a loooooooong php snippet for automatic title module. Each World War, 1939-1945, German Concentration Camps and Prisons Collection node should have a title that follows a specific pattern. It may not be the prettiest and most elegant snippet, but it works!

<?php
$pow = '[field_pow_camp-formatted]';
$prison = '[field_prison_camp-formatted]';
$gestapo = '[field_gestapo_camp-formatted]';
$creator = '[field_creator-formatted]';
$internment = '[field_internment_camp-formatted]';
if (empty($creator) && empty($pow) && empty($internment) && empty($prison) && empty($gestapo)) {
	return htmlspecialchars_decode("[field_source-formatted],  [field_date-formatted] ", ENT_QUOTES);
}
		elseif (empty($creator) && empty($pow) && empty($internment) && empty($prison)) {
			return htmlspecialchars_decode("[field_source-formatted] - [field_gestapo_camp-formatted] [field_date-formatted]", ENT_QUOTES);
		}
		elseif (empty($pow) && empty($internment) && empty($prison)) {
			return htmlspecialchars_decode("[field_source-formatted], From: [field_creator-formatted] To: [field_recipient-formatted] - [field_gestapo_camp-formatted] [field_date-formatted]", ENT_QUOTES);
		}
		elseif (empty($creator) && empty($pow) && empty($internment) && empty($gestapo)) {
			return htmlspecialchars_decode("[field_source-formatted] - [field_prison_camp-formatted] [field_date-formatted]", ENT_QUOTES);
		}
		elseif (empty($pow) && empty($internment) && empty($gestapo)) {
			return htmlspecialchars_decode("[field_source-formatted], From: [field_creator-formatted] To: [field_recipient-formatted] - [field_prison_camp-formatted] [field_date-formatted]", ENT_QUOTES);
		}
		elseif (empty($creator) && empty($pow) && empty($prison) && empty($gestapo)) {
			return htmlspecialchars_decode("[field_source-formatted] - [field_internment_camp-formatted] [field_date-formatted]", ENT_QUOTES);
		}
		elseif (empty($pow) && empty($prison) && empty($gestapo)) {
			return htmlspecialchars_decode("[field_source-formatted], From: [field_creator-formatted] To: [field_recipient-formatted] - [field_internment_camp-formatted] [field_date-formatted]", ENT_QUOTES);
		}
		elseif (empty($creator) && empty($internment) && empty($prison) && empty($gestapo)) {
			return htmlspecialchars_decode("[field_source-formatted] - [field_pow_camp-formatted] [field_date-formatted]", ENT_QUOTES);	
		}
		elseif (empty($internment) && empty($prison) && empty($gestapo)) {
			return htmlspecialchars_decode("[field_source-formatted], From: [field_creator-formatted] To: [field_recipient-formatted] - [field_pow_camp-formatted] [field_date-formatted]", ENT_QUOTES);
		}
?>
Avatar
Nick Ruest
Associate Librarian

Related

comments powered by Disqus