Project

General

Profile

Feature #17264 » 0005530_seminars.patch

Administrator Admin, 2007-11-23 21:46

View differences:

seminars/class.tx_seminars_tcemain.php 2007-11-23 20:44:53.000000000 +0100
require_once(t3lib_extMgm::extPath('seminars').'class.tx_seminars_seminar.php');
require_once(t3lib_extMgm::extPath('seminars').'class.tx_seminars_timeslot.php');
class tx_seminars_tcemainprocdm extends tx_seminars_dbplugin {
class tx_seminars_tcemainprocdm extends tx_seminars_dbplugin {
var $tceMainFieldArrays = array();
/**
* The constructor.
*
......
return;
}
/**
* Handles data after everything had been written to the storage.
*
* @param t3lib_TCEmain $pObj: Calling TCEmain object
* @return void
*
* @access public
* @author Oliver Hader <oh@inpublica.de>
*/
function processDatamap_afterAllOperations(&$pObj) {
$tables = array(
$this->tableSeminars,
$this->tableTimeslots,
);
foreach ($tables as $table) {
if (isset($this->tceMainFieldArrays[$table]) && is_array($this->tceMainFieldArrays[$table])) {
foreach ($this->tceMainFieldArrays[$table] as $id => $fieldArray) {
// only do the database query if the right table was modified
switch ($table) {
case $this->tableSeminars:
// Initialize a seminar object to have all functions available.
$seminarClassname = t3lib_div::makeInstanceClassName(
'tx_seminars_seminar'
);
$seminar =& new $seminarClassname($id, null, true);
if ($seminar->isOk()) {
// Store the begin_date of the earliest and the end_date of
// the latest time slot and the places of all timeslots in
// the corresponding fields of the event record.
$seminar->storeBeginDateOfTimeSlots();
$seminar->storeEndDateOfTimeSlots();
$seminar->storePlacesOfTimeSlots();
// Get an associative array of fields that need to be updated
// in the database.
$updateArray = $seminar->getUpdateArray($fieldArray);
// Only update the record in the database if needed.
if (count($updateArray)) {
$GLOBALS['TYPO3_DB']->exec_UPDATEquery(
$this->tableSeminars,
'uid='.$id,
$updateArray
);
}
}
break;
case $this->tableTimeslots:
// Initialize a timeslot object to have all functions available
$timeslotClassname = t3lib_div::makeInstanceClassName(
'tx_seminars_timeslot'
);
$timeslot =& new $timeslotClassname($id, null);
if ($timeslot->isOk()) {
// Get an associative array of fields that need to be updated
// in the database.
$updateArray = $timeslot->getUpdateArray($fieldArray);
// Only update the record in the database if needed.
if (count($updateArray)) {
$GLOBALS['TYPO3_DB']->exec_UPDATEquery(
$this->tableTimeslots,
'uid='.$id,
$updateArray
);
}
}
break;
default:
// Do nothing.
break;
}
}
}
}
}
/**
* Checks that the registration deadline set by the user is in no way larger
* (=later) than the beginning of the event.
......
// only do the database query if the right table was modified
switch ($table) {
case $this->tableSeminars:
// Initialize a seminar object to have all functions available.
$seminarClassname = t3lib_div::makeInstanceClassName(
'tx_seminars_seminar'
);
$seminar =& new $seminarClassname($id, null, true);
if ($seminar->isOk()) {
// Store the begin_date of the earliest and the end_date of
// the latest time slot and the places of all timeslots in
// the corresponding fields of the event record.
$seminar->storeBeginDateOfTimeSlots();
$seminar->storeEndDateOfTimeSlots();
$seminar->storePlacesOfTimeSlots();
// Get an associative array of fields that need to be updated
// in the database.
$updateArray = $seminar->getUpdateArray($fieldArray);
// Only update the record in the database if needed.
if (count($updateArray)) {
$GLOBALS['TYPO3_DB']->exec_UPDATEquery(
$this->tableSeminars,
'uid='.$id,
$updateArray
);
}
}
case $this->tableSeminars:
$this->tceMainFieldArrays[$table][$id] = $fieldArray;
break;
case $this->tableTimeslots:
// Initialize a timeslot object to have all functions available
$timeslotClassname = t3lib_div::makeInstanceClassName(
'tx_seminars_timeslot'
);
$timeslot =& new $timeslotClassname($id, null);
if ($timeslot->isOk()) {
// Get an associative array of fields that need to be updated
// in the database.
$updateArray = $timeslot->getUpdateArray($fieldArray);
// Only update the record in the database if needed.
if (count($updateArray)) {
$GLOBALS['TYPO3_DB']->exec_UPDATEquery(
$this->tableTimeslots,
'uid='.$id,
$updateArray
);
}
}
$this->tceMainFieldArrays[$table][$id] = $fieldArray;
break;
default:
// Do nothing.
(1-1/4)