public function getMappedMedbiqInstructionalMethod() { return Models_Event_MapEventsEventType::fetchRowByEventTypeID($this->eventtype_id); }
if ($eventtype_organisation) { if ($eventtype->insert()) { // if creating a new eventtype we will need to delete the old one, then update all of the previously fetched events to the new one. $eventtype_id = $eventtype->getID(); $eto = new Models_Event_EventTypeOrganisation(array("eventtype_id" => $PROCESSED["eventtype_id"], "organisation_id" => $ORGANISATION_ID)); if (!$eto->delete()) { application_log("error", "An error occured while attempting to delete the organisation eventtype " . $eto->getEventTypeID() . " DB said: " . $db->ErrorMsg()); add_error("An error while attempting to delete the organisation event type"); } else { $eto->setEventTypeID($eventtype_id); if (!$eto->insert()) { application_log("error", "An error occured while attempting to insert the organisation eventtype " . $eto->getEventTypeID() . " DB said: " . $db->ErrorMsg()); add_error("An error while attempting to insert the organisation event type"); } } $mapped_instructional_method = Models_Event_MapEventsEventType::fetchRowByEventTypeID($PROCESSED["eventtype_id"]); if ($mapped_instructional_method) { $mapped_instructional_method->delete(); } if (isset($PROCESSED["medbiq_instructional_method_id"])) { $mapped_method = new Models_Event_MapEventsEventType(array("fk_instructional_method_id" => $PROCESSED["medbiq_instructional_method_id"], "fk_eventtype_id" => $eventtype_id, "updated_date" => time(), "updated_by" => $ENTRADA_USER->getID())); if (!$mapped_method->insert()) { application_log("error", "An error occured while attempting to insert the medbiq instructional method " . $mapped_method->getID() . " DB said: " . $db->ErrorMsg()); add_error("An error occured while attempting to save the selected medbiq instructional method " . $db->ErrorMsg()); } } // we need a list of event_ids that are associated with this eventtype_id $query = "\tSELECT b.`event_id`, c.*\n FROM `courses` AS a\n LEFT JOIN `events` AS b\n ON a.`course_id` = b.`course_id`\n LEFT JOIN `event_eventtypes` AS c\n ON b.`event_id` = c.`event_id`\n WHERE a.`organisation_id` = " . $db->qstr($ORGANISATION_ID) . "\n AND c.`eventtype_id` = " . $db->qstr($PROCESSED["eventtype_id"]); $events_list = $db->GetAssoc($query); if ($events_list) { foreach ($events_list as $event_id => $event) {