« May 2009 | Main | July 2009 »

June 27, 2009

Famous Hostels

Book the Best Hostel in Europe - Europe's Famous Hostels

Posted by pj at 12:56 PM | Comments (0)

June 26, 2009

Caching the date info for MSM Single Calendar Events


require_once $SYSTEM_ROOT.'/packages/calendar/calendar_event/calendar_event.inc';

.....................

function cache_calendar_dates($asset_id, $add_edit){

    $cal = $GLOBALS['SQ_SYSTEM']->am->getAsset($asset_id);
    
    if($add_edit == 'add'){ return $cal->cacheCalendarData(FALSE); }
    
    else{ return $cal->cacheCalendarData(TRUE); }
    
    }

Posted by pj at 11:42 PM | Comments (0)

Calendar date functions in MSM

In /mysource_matrix/packages/calendar/calendar_event/calendar_event.inc

	/**
	* Cache the calendar data's stuff
	*
	* The return value indicates the success
	*
	* @param boolean	$updating	are we updating (TRUE) or inserting a new record
	*								(FALSE - set only in create() call)
	*
	* @return boolean
	* @access public
	*/
	function cacheCalendarData($updating=TRUE)
	{
		$GLOBALS['SQ_SYSTEM']->changeDatabaseConnection('db2');
		$db = MatrixDal::getDb();

		$date_values = Array();

		foreach (Array('start_date', 'end_date') as $date_comp) {
			$iso = $this->attr($date_comp);

			if (iso8601_time_component($iso) === FALSE) {
				if (($date_comp == 'end_date') && (iso8601_date_component($iso) !== FALSE)) {
					$iso = substr($iso, 0, 10).' 24:00:00';
				}
			} else {
				// we know the seconds aren't going to be there, so zero them so we can
				// use the getDate() niceness
				$iso = substr($iso, 0, 16).':00';
			}

			// we have the best, now get the rest
			$date_values += Calendar_Common::getDateComponents($iso, $date_comp.'_');
		}

		// frequency field => blank for standard events, overridden in recurring
		$date_values['frequency'] = '';

		$GLOBALS['SQ_SYSTEM']->doTransaction('BEGIN');

		if (!$updating) {
			// set the asset ids
			$date_values['assetid'] = $this->id;

			for (reset($date_values); NULL !== ($key = key($date_values)); next($date_values)) {
				if (is_null($date_values[$key]))
					$date_values[$key] = 'NULL';
				else
				$date_values[$key] = MatrixDAL::quote($date_values[$key]);
			}
			$val_string = implode(',', $date_values);

			$sql = 'INSERT INTO
						sq_cal_date_val
						(
							'.implode(',', array_keys($date_values)).'
						)
						VALUES
						(
							'.$val_string.'
						)';

			try {
				$query = MatrixDAL::preparePdoQuery($sql);
				MatrixDAL::execPdoQuery($query);
			} catch (Exception $e) {
				throw new Exception($e->getMessage());
			}
		} else {
			// asset id becomes a where condition
			$sql = 'UPDATE
						sq_cal_date_val
					SET ';

			$set_array = Array();
			foreach ($date_values as $key => $value) {
				$set_array[] = $key.' = '.((is_null($value)) ? 'null' : MatrixDAL::quote($value));
			}
			$sql .= implode(',', $set_array);
			$sql .=' WHERE
						assetid = :assetid';

			try {
				$query = MatrixDAL::preparePdoQuery($sql);
				MatrixDAL::bindValueToPdo($query, 'assetid', $this->id);
				MatrixDAL::execPdoQuery($query);
			} catch (Exception $e) {
				throw new Exception($e->getMessage());
			}
		}

		$GLOBALS['SQ_SYSTEM']->doTransaction('COMMIT');
		$GLOBALS['SQ_SYSTEM']->restoreDatabaseConnection();

		return TRUE;

	}//end cacheCalendarData()

Posted by pj at 10:53 PM | Comments (0)

Syncing code between two repositories

cd /opt/coolstack/apache2/htdocs; svn export --force svn://172.20.52.51:8081/svn-repository/waf .; svn commit -m=""; chown -R webservd *

Posted by pj at 12:03 PM | Comments (0)

June 20, 2009

What's On - Edinburgh

Music, Edinburgh | Events | The List

Posted by pj at 11:07 AM | Comments (0)

June 13, 2009

Pop Art Canvases

steve mcqueen pop art design.php

Posted by pj at 10:15 PM | Comments (0)

June 01, 2009

XSL for transforming RSS 2.0 to RSS 1.0

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" id="rss2to1"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                xmlns:dc="http://purl.org/dc/elements/1.1/"
                xmlns="http://purl.org/rss/1.0/"
                >
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/rss"><xsl:apply-templates/></xsl:template>
<xsl:template match="channel">
<rdf:RDF>
    <channel rdf:about="{link}">
    <title><xsl:value-of select="title"/></title>  
    <description><xsl:value-of select="description"/></description>  
    <link><xsl:value-of select="link"/></link>    
    <items>
        <rdf:Seq>
            <xsl:for-each select="item"><rdf:li  rdf:resource="{link}"/></xsl:for-each>
        </rdf:Seq>
    </items>
   </channel>
    <xsl:for-each select="item">
    <item rdf:about="{link}">
        <title><xsl:value-of select="title"/></title>  
        <description><xsl:value-of select="description"/></description>  
        <link><xsl:value-of select="link"/></link>
        <dc:date><xsl:call-template name="FormatDate"><xsl:with-param name="DateTime"  select="pubDate"/></xsl:call-template></dc:date>
    </item>
    </xsl:for-each>
    </rdf:RDF>
</xsl:template>
  <xsl:template name="FormatDate">
    <xsl:param name="DateTime" />
    <!-- new date format 2006-01-14T08:55:22Z -->
    <xsl:variable name="mo">
      <xsl:value-of select="substring($DateTime,9,3)" />
    </xsl:variable>
    <xsl:variable name="day">
      <xsl:value-of select="substring($DateTime,6,2)" />
    </xsl:variable>
    <xsl:variable name="year">
      <xsl:value-of select="substring($DateTime,13,4)" />
    </xsl:variable>
    <xsl:variable name="time">
      <xsl:value-of select="substring($DateTime,18,8)" />
    </xsl:variable>
    <xsl:variable name="hh">
      <xsl:value-of select="substring($time,1,2)" />
    </xsl:variable>
    <xsl:variable name="mm">
      <xsl:value-of select="substring($time,4,2)" />
    </xsl:variable>
    <xsl:variable name="ss">
      <xsl:value-of select="substring($time,7,2)" />
    </xsl:variable>
    <xsl:value-of select="$year"/>
    <xsl:value-of select="'-'"/>
    <xsl:choose>
      <xsl:when test="$mo = 'Jan'">01</xsl:when>
      <xsl:when test="$mo = 'Feb'">02</xsl:when>
      <xsl:when test="$mo = 'Mar'">03</xsl:when>
      <xsl:when test="$mo = 'Apr'">04</xsl:when>
      <xsl:when test="$mo = 'May'">05</xsl:when>
      <xsl:when test="$mo = 'Jun'">06</xsl:when>
      <xsl:when test="$mo = 'Jul'">07</xsl:when>
      <xsl:when test="$mo = 'Aug'">08</xsl:when>
      <xsl:when test="$mo = 'Sep'">09</xsl:when>
      <xsl:when test="$mo = 'Oct'">10</xsl:when>
      <xsl:when test="$mo = 'Nov'">11</xsl:when>
      <xsl:when test="$mo = 'Dec'">12</xsl:when>
    </xsl:choose>

    <xsl:value-of select="'-'"/>
    <xsl:if test="(string-length($day) < 2)">
      <xsl:value-of select="0"/>
    </xsl:if>
    <xsl:value-of select="$day"/>
    <xsl:value-of select="'T'"/>
    <xsl:value-of select="$hh"/>
    <xsl:value-of select="':'"/>
    <xsl:value-of select="$mm"/>
    <xsl:value-of select="':'"/>
    <xsl:value-of select="$ss"/>
    <xsl:value-of select="'Z'"/>
  </xsl:template>

</xsl:stylesheet>

Posted by pj at 09:02 PM | Comments (0)

XSL for formatting a date

XSLT - format date

Posted by pj at 04:02 PM | Comments (0)

RSS 1.0 Job Vacancy Schema

RDF Site Summary 1.0 Modules: Job Vacancies - Version 0.1

Authors

Paul Hollands

URI

http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/

Previous version

http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/

Revision

$Revision: 0.1 $

Last update

$Date: 2005/07/14 21:58:18.295 GMT $

Status

Draft

Rights

Copyright © 2004-2005 Paul Hollands

Available under a Creative Commons License. Some rights reserved by the author.

Creative Commons License

Description

RSS 1.0 module, for sharing information about UK Higher Education job vacancies.

While this module is primarily designed to allow interoperation and sharing of funding opportunity information among the UK Higher Education Academy it's use further abroad would be most welcome.

Example feed:

An example feed can be found at: http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/jobs_example.rdf

Namespace decalaration

  • <xmlns:fundop=http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/rss1.0jobsmodule#/>

RDF Schema definition document

The following RDFS document is embedded in this page: http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/rss1.0jobsmodule

RSS 1.0 module for job vacancies in UK higher education

RSS 1.0 module, for sharing information about UK Higher job vacancies.

Vacancy Class

The overarching class for job vacancies

This is a sub-class of:

  • http://purl.org/rss/1.0/Item
  • http://www.w3.org/2000/01/rdf-schema#Resource

Class defined by:

  • http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/rss1.0jobsmodule#

Organization Class

An organization to be used as an object of vacancy with or apply to properties

This is a sub-class of:

  • http://www.w3.org/2000/01/rdf-schema#Resource

Class defined by:

  • http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/rss1.0jobsmodule#
  • http://www.w3.org/2001/vcard-rdf/3.0#
  • http://xmlns.com/foaf/0.1/Organization

This class is an equivalent of:

  • http://xmlns.com/foaf/0.1/Organization

This class is disjoint with:

  • http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/rss1.0jobsmodule#Person

Person Class

A person node to be used as an object for the apply to property

This is a sub-class of:

  • http://www.w3.org/2000/01/rdf-schema#Resource

Class defined by:

  • http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/rss1.0jobsmodule#
  • http://www.w3.org/2001/vcard-rdf/3.0#
  • http://xmlns.com/foaf/0.1/Person

This class is an equivalent of:

  • http://xmlns.com/foaf/0.1/Person

This class is disjoint with:

  • http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/rss1.0jobsmodule#Organization

ApplicationDeadline Class

Node for the deadline start and end dates for applications

This is a sub-class of:

  • http://www.w3.org/2000/01/rdf-schema#Resource

Class defined by:

  • http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/rss1.0jobsmodule#

Range should be some values from:

  • http://purl.org/rss/1.0/modules/event/startdate
  • http://purl.org/rss/1.0/modules/event/enddate

SalaryRange Class

The salary range for this vacancy.

This is a sub-class of:

  • http://www.w3.org/2000/01/rdf-schema#Resource

Class defined by:

  • http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/rss1.0jobsmodule#

Range should be some values from:

  • #minimumsalary
  • #maximumsalary

minimumsalary property

Minimum value in the salary range.

Property defined by:

  • http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/rss1.0jobsmodule#

Property is in the following domains:

  • http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/rss1.0jobsmodule#SalaryRange

Range should be one of:

  • http://www.w3.org/2001/XMLSchema#integer
  • Negotiable

maximumsalary property

Maximum value in the salary range.

Property defined by:

  • http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/rss1.0jobsmodule#

Property is in the following domains:

  • http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/rss1.0jobsmodule#SalaryRange

Range should be one of:

  • http://www.w3.org/2001/XMLSchema#integer
  • Negotiable

currency property

The currency which the salary is offered in. Use ISO 4217 currency codes. Default is GBP.

Property defined by:

  • http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/rss1.0jobsmodule#

Property is in the following domains:

  • http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/rss1.0jobsmodule#SalaryRange

Is in the range of:

  • http://www.w3.org/2000/01/rdf-schema#Literal

furtherdetails property

The URI of the web page describing this vacancy

Property defined by:

  • http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/rss1.0jobsmodule#

Property is in the following domains:

  • http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/rss1.0jobsmodule#Vacancy

Is in the range of:

  • http://www.w3.org/2000/01/rdf-schema#Resource

contractduration property

Duration of contract in days.

This is a sub-property of:

  • http://www.w3.org/2001/XMLSchema#integer

Property defined by:

  • http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/rss1.0jobsmodule#

Property is in the following domains:

  • http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/rss1.0jobsmodule#Vacancy

Range should be one of:

  • http://www.w3.org/2001/XMLSchema#integer
  • Permanent

furtherdetails property

Item property to hold Vacancy reference

Property defined by:

  • http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/rss1.0jobsmodule#

Property is in the following domains:

  • http://purl.org/rss/1.0/item

Is in the range of:

  • http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/rss1.0jobsmodule#Vacancy
  • http://www.w3.org/2000/01/rdf-schema#Resource

salaryrange property

Property pointing to a SalaryRange node

Property defined by:

  • http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/rss1.0jobsmodule#

Property is in the following domains:

  • http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/rss1.0jobsmodule#Vacancy

Is in the range of:

  • http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/rss1.0jobsmodule#SalaryRange
  • http://www.w3.org/2000/01/rdf-schema#Resource

applicationdeadline property

Property pointing to an ApplicationDeadline node

Property defined by:

  • http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/rss1.0jobsmodule#

Property is in the following domains:

  • http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/rss1.0jobsmodule#Vacancy

Is in the range of:

  • http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/rss1.0jobsmodule#ApplicationDeadline
  • http://www.w3.org/2000/01/rdf-schema#Resource

vacancywith property

Property pointing to an Organization node

Property defined by:

  • http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/rss1.0jobsmodule#

Property is in the following domains:

  • http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/rss1.0jobsmodule#Vacancy

Is in the range of:

  • http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/rss1.0jobsmodule#Organization
  • http://www.w3.org/2000/01/rdf-schema#Resource

percentagefte property

The precentage of FTE (Full Time Equivalent)

Property defined by:

  • http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/rss1.0jobsmodule#

Property is in the following domains:

  • http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/rss1.0jobsmodule#SalaryRange

Is in the range of:

  • http://www.w3.org/2000/01/rdf-schema#Literal

Range should be one of:

  • http://www.w3.org/2001/XMLSchema#integer
  • http://www.w3.org/2001/XMLSchema#float

localreference property

Reference number assigned by advertiser

Property defined by:

  • http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/rss1.0jobsmodule#

Property is in the following domains:

  • http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/rss1.0jobsmodule#Vacancy

Is in the range of:

  • http://www.w3.org/2000/01/rdf-schema#Literal

Example feed:

An example feed can be found at: http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/jobs_example_rdf

<?xml version="1.0"?>
<rdf:RDF
	xml:base="http://minnesota.ncl.ac.uk/fundops_example.owl"
	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
	xmlns:owl="http://www.w3.org/2002/07/owl#"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
	xmlns:jobs="http://www.medev.ac.uk/interoperability/rss/1.0/modules/jobs/rss1.0jobsmodule#"
	xmlns:vcard="http://www.w3.org/2001/vcard-rdf/3.0#"
	xmlns:dcterms="http://purl.org/dc/terms/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:event="http://purl.org/rss/1.0/modules/event/"
	xmlns:foaf="http://xmlns.com/foaf/0.1/"
	xmlns:cc="http://web.resource.org/cc/"
	xmlns:rss="http://purl.org/rss/1.0/"
	xmlns="http://purl.org/rss/1.0/"
>

	<cc:License rdf:nodeID="license">
		<dc:identifier rdf:resource="http://creativecommons.org/licenses/by-nc-sa/2.0/"/>

		<cc:requires rdf:resource="http://web.resource.org/cc/Attribution"/>
		<cc:requires rdf:resource="http://web.resource.org/cc/Notice"/>
		<cc:requires rdf:resource="http://web.resource.org/cc/ShareAlike"/>
		<cc:permits rdf:resource="http://web.resource.org/cc/Reproduction"/>
		<cc:permits rdf:resource="http://web.resource.org/cc/Distribution"/>
		<cc:permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/>

		<cc:prohibits rdf:resource="http://web.resource.org/cc/CommercialUse"/>
	</cc:License>
	
	<channel rdf:about="http://www.medev.ac.uk/interoperability/jobs_example.owl">
		<title xml:lang="en-GB">Sample jobs RSS 1.0 feed.</title>
		<description xml:lang="en-GB">

			Sample jobs feed using new schema definition.
		</description>
		<link>http://www.medev.ac.uk/resources/news/jobs/</link>
		<dc:date>2005-06-16T15:55:00Z</dc:date>
		<items>

			<rdf:Seq>
				<rdf:li rdf:resource="http://www.jobs.ac.uk/jobfiles/TH558.html"/>
			</rdf:Seq>
		</items>
		<cc:license rdf:nodeID="license"/>
	</channel>

	
	<item rdf:about="http://www.jobs.ac.uk/jobfiles/TH558.html">
		<dc:format>text/html</dc:format>
		<dc:date>2004-07-30T17:30:00Z</dc:date>
		<dc:source rdf:resource="http://www.medev.ac.uk/resources/fundops/"/>
		<title xml:lang="en-GB">Clinical Lecturer in Endocrinology / 
		Diabetes, Division Of Medical Sciences</title>

		<description xml:lang="en-GB">
		Applications are invited for the post of Clinical Lecturer with a special interest 
		in Endocrinology/ Diabetes. Possession of MRCP is essential. The post represents 1 
		of 4 General Medicine Endocrinology and Diabetes, which together provide a programme
		for higher medical training in these specialities. The successful applicant is 
		likely to rotate between UHB Trust and Heartlands Trust.

		The post holder will have responsibility for the care of inpatients 
		and outpatients with general medicine and diabetic and/ or endocrine problems, 
		teaching of medical students and postgraduate students, and co-ordination of
		undergraduate medical examinations.

		Research is an important component of this post and it is hoped that the successful 
		candidate will be able to join a programme of research in line with the current 
		activities of the Division. At the last RAE, the University scored a 5 in hospital 
		based clinical subjects and 6 in laboratory sciences establishing the Medical School
		in Birmingham as one of the premier in the UK.
		</description>
		<dc:subject>Medical Education</dc:subject>
		<jobs:advertises rdf:nodeID="vacancy_0"/>
	</item>

	
	<jobs:Vacancy rdf:nodeID="vacancy_0">
		<title xml:lang="en-GB">Clinical Lecturer in Endocrinology / 
		Diabetes, Division Of Medical Sciences</title>
		<jobs:contractduration><xsd:integer rdf:value="1695"/></jobs:contractduration>
		<jobs:salaryrange rdf:nodeID="salary_range_0"/>
		<jobs:applicationdeadline rdf:nodeID="application_deadline_0"/>

		<jobs:vacancywith rdf:resource="http://www.bham.ac.uk/"/>
		<jobs:applyto rdf:resource="http://www.personnel.bham.ac.uk/"/>
		<jobs:localreference rdf:value="M1012"/>
	</jobs:Vacancy>
	
	<jobs:SalaryRange rdf:nodeID="salary_range_0">
		<jobs:minimumsalary><xsd:integer rdf:value="28307"/></jobs:minimumsalary>

		<jobs:maximumsalary><xsd:integer rdf:value="49042"/></jobs:maximumsalary>
		<jobs:currency rdf:value="GBP"/>
		<jobs:percentagefte><xsd:integer rdf:value="100"/></jobs:percentagefte>
	</jobs:SalaryRange>
	
	<jobs:ApplicationDeadline rdf:nodeID="aplication_deadline_0">

		<event:enddate rdf:value="2004-07-30T17:30:00Z"/>
	</jobs:ApplicationDeadline>
	
	<jobs:Organization rdf:about="http://www.bham.ac.uk/">
		<vcard:ORG rdf:parseType="Resource">
			<vcard:Orgname xml:lang="en-GB">The University of Birmingham</vcard:Orgname>

		</vcard:ORG>
	</jobs:Organization>
	
	<jobs:Organization rdf:about="http://www.personnel.bham.ac.uk/">
		<vcard:ORG rdf:parseType="Resource">
			<vcard:Orgname xml:lang="en-GB">Personnel Services</vcard:Orgname>

		</vcard:ORG>
		<vcard:ADDR rdf:parseType="Resource">
			<vcard:Street xml:lang="en-GB"> The University of Birmingham,
				Edgbaston
			</vcard:Street>
			<vcard:Locality xml:lang="en-GB">Birmingham</vcard:Locality>

			<vcard:Pcode>B15 2TT</vcard:Pcode>
			<vcard:Region 
		rdf:type="http://www.rdn.ac.uk/publications/rdn-ltsn/geographic-coverage/" 
		xml:lang="en-GB" rdf:value="UK"/>
		</vcard:ADDR>
		<vcard:TEL rdf:parseType="Resource">
			<rdf:value>0121 415 9000</rdf:value>

			<rdf:type rdf:resource="http://www.w3.org/2001/vcard-rdf/3.0#voice"/>
			<rdf:type rdf:resource="http://www.w3.org/2001/vcard-rdf/3.0#work"/>
		</vcard:TEL>
	</jobs:Organization>
		
</rdf:RDF>

Posted by pj at 12:51 PM | Comments (0)