function handlerBeginTag($a_xml_parser, $a_name, $a_attribs) { if ($this->in_meta_data) { parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs); return true; } switch ($a_name) { case 'MetaData': $this->in_meta_data = true; parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs); return true; default: // hier die Tags aller nicht-MetaData Attribute } }
function handlerBeginTag($a_xml_parser, $a_name, $a_attribs) { if ($this->in_meta_data and !$this->__inFilter($a_name)) { parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs); return true; } switch ($a_name) { case 'MetaData': $this->in_meta_data = true; parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs); break; case 'Identifier': $par =& $this->__getParent(); $this->md_ide =& $par->addIdentifier(); $this->md_ide->setCatalog($a_attribs['Catalog']); $this->md_ide->setEntry('il__' . $this->md->getObjType() . '_' . $this->md->getObjId()); $this->md_ide->save(); $this->__pushParent($this->md_ide); break; } return true; }
/** * handler for begin of element * * @param resource $a_xml_parser xml parser * @param string $a_name element name * @param array $a_attribs element attributes array */ public function handlerBeginTag($a_xml_parser, $a_name, $a_attribs) { global $ilErr; if ($this->in_metadata) { parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs); return; } switch ($a_name) { case "MetaData": $this->in_metadata = true; // Delete old meta data $md = new ilMD($this->getWebLink()->getId(), 0, 'webr'); $md->deleteAll(); parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs); break; case 'WebLink': $this->current_link_update = false; $this->current_link_delete = false; $this->current_parameters = array(); if ($this->getMode() == self::MODE_CREATE or isset($a_attribs['action']) and $a_attribs['action'] == 'Create') { // New weblink $this->current_link = new ilLinkResourceItems($this->getWebLink()->getId()); } elseif ($this->getMode() == self::MODE_UPDATE and $a_attribs['action'] == 'Delete') { $this->current_link_delete = true; $this->current_link = new ilLinkResourceItems($this->getWebLink()->getId()); $this->current_link->delete($a_attribs['id']); break; } elseif ($this->getMode() == self::MODE_UPDATE and ($a_attribs['action'] == 'Update' or !isset($a_attribs['action']))) { $this->current_link = new ilLinkResourceItems($this->getWebLink()->getId()); $this->current_link->readItem($a_attribs['id']); $this->current_link_update = true; // Delete all dynamic parameter include_once './Modules/WebResource/classes/class.ilParameterAppender.php'; foreach (ilParameterAppender::getParameterIds($this->getWebLink()->getId(), $a_attribs['id']) as $param_id) { $param = new ilParameterAppender($this->getWebLink()->getId()); $param->delete($param_id); } } else { throw new ilWebLinkXmlParserException('Invalid action given for element "Weblink"'); } // Active $this->current_link->setActiveStatus($a_attribs['active'] ? 1 : 0); // Valid if (!isset($a_attribs['valid'])) { $valid = 1; } else { $valid = $a_attribs['valid'] ? 1 : 0; } $this->current_link->setValidStatus($valid); // Disable check $this->current_link->setDisableCheckStatus($a_attribs['disableValidation'] ? 1 : 0); break; case 'Sorting': include_once './Services/Container/classes/class.ilContainerSortingSettings.php'; $sort = new ilContainerSortingSettings($this->getWebLink()->getId()); $sort->delete(); switch ($a_attribs['type']) { case 'Manual': $sort->setSortMode(ilContainer::SORT_MANUAL); break; case 'Title': default: $sort->setSortMode(ilContainer::SORT_TITLE); } $sort->save(); break; case 'WebLinks': case 'Title': case 'Description': case 'Target': // Nothing to do break; case 'DynamicParameter': $param = new ilParameterAppender($this->getWebLink()->getId()); $param->setName($a_attribs['name']); switch ($a_attribs['type']) { case 'userName': # $GLOBALS['ilLog']->write("VALUE: ".LINKS_LOGIN); $param->setValue(LINKS_LOGIN); break; case 'userId': # $GLOBALS['ilLog']->write("VALUE: ".LINKS_USER_ID); $param->setValue(LINKS_USER_ID); break; case 'matriculation': # $GLOBALS['ilLog']->write("VALUE: ".LINKS_MATRICULATION); $param->setValue(LINKS_MATRICULATION); break; default: throw new ilWebLinkXmlParserException('Invalid attribute "type" given for element "Dynamic parameter". Aborting'); break; } $this->current_parameters[] = $param; break; } }
/** * handler for begin of element * * @param resource $a_xml_parser xml parser * @param string $a_name element name * @param array $a_attribs element attributes array */ function handlerBeginTag($a_xml_parser, $a_name, $a_attribs) { if ($this->in_meta_data) { parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs); return; } switch ($a_name) { case 'Course': if (strlen($a_attribs['importId'])) { $this->log->write("CourseXMLParser: importId = " . $a_attribs['importId']); $this->course_obj->setImportId($a_attribs['importId']); ilObject::_writeImportId($this->course_obj->getId(), $a_attribs['importId']); } if (strlen($a_attribs['showMembers'])) { $this->course_obj->setShowMembers($a_attribs['showMembers'] == 'Yes' ? true : false); } break; case 'Admin': if ($id_data = $this->__parseId($a_attribs['id'])) { if ($id_data['local'] or $id_data['imported']) { $this->handleAdmin($a_attribs, $id_data); } } break; case 'Tutor': if ($id_data = $this->__parseId($a_attribs['id'])) { if ($id_data['local'] or $id_data['imported']) { $this->handleTutor($a_attribs, $id_data); } } break; case 'Member': if ($id_data = $this->__parseId($a_attribs['id'])) { if ($id_data['local'] or $id_data['imported']) { $this->handleMember($a_attribs, $id_data); } } break; case 'Subscriber': if ($id_data = $this->__parseId($a_attribs['id'])) { if ($id_data['local'] or $id_data['imported']) { $this->handleSubscriber($a_attribs, $id_data); } } break; case 'WaitingList': if ($id_data = $this->__parseId($a_attribs['id'])) { if ($id_data['local'] or $id_data['imported']) { $this->handleWaitingList($a_attribs, $id_data); } } break; case 'Settings': $this->in_settings = true; break; case 'Availability': $this->in_availability = true; break; case 'NotAvailable': if ($this->in_availability) { $this->course_obj->setActivationType(IL_CRS_ACTIVATION_OFFLINE); } elseif ($this->in_registration) { $this->course_obj->setSubscriptionLimitationType(IL_CRS_SUBSCRIPTION_DEACTIVATED); } break; case 'Unlimited': if ($this->in_availability) { $this->course_obj->setOfflineStatus(false); $this->course_obj->setActivationType(IL_CRS_ACTIVATION_UNLIMITED); } elseif ($this->in_registration) { $this->course_obj->setSubscriptionLimitationType(IL_CRS_SUBSCRIPTION_UNLIMITED); } break; case 'TemporarilyAvailable': if ($this->in_availability) { $this->course_obj->setOfflineStatus(false); $this->course_obj->setActivationType(IL_CRS_ACTIVATION_LIMITED); } elseif ($this->in_registration) { $this->course_obj->setSubscriptionLimitationType(IL_CRS_SUBSCRIPTION_LIMITED); } break; case 'Start': break; case 'End': break; case 'Syllabus': break; case 'Contact': break; case 'Name': case 'Responsibility': case 'Phone': case 'Email': case 'Consultation': break; case 'Registration': $this->in_registration = true; switch ($a_attribs['registrationType']) { case 'Confirmation': $this->course_obj->setSubscriptionType(IL_CRS_SUBSCRIPTION_CONFIRMATION); break; case 'Direct': $this->course_obj->setSubscriptionType(IL_CRS_SUBSCRIPTION_DIRECT); break; case 'Password': $this->course_obj->setSubscriptionType(IL_CRS_SUBSCRIPTION_PASSWORD); break; } $this->course_obj->setSubscriptionMaxMembers((int) $a_attribs['maxMembers']); $this->course_obj->setSubscriptionNotify($a_attribs['notification'] == 'Yes' ? true : false); $this->course_obj->enableWaitingList($a_attribs['waitingList'] == 'Yes' ? true : false); break; case 'Sort': switch ($a_attribs['type']) { case 'Manual': $this->course_obj->setOrderType(ilContainer::SORT_MANUAL); break; case 'Title': $this->course_obj->setOrderType(ilContainer::SORT_TITLE); break; case 'Activation': $this->course_obj->setOrderType(ilContainer::SORT_ACTIVATION); break; } break; case 'Archive': $this->in_archive = true; switch ($a_attribs['Access']) { case 'Disabled': $this->course_obj->setArchiveType(IL_CRS_ARCHIVE_NONE); break; case 'Read': $this->course_obj->setArchiveType(IL_CRS_ARCHIVE_NONE); #$this->course_obj->setViewMode(IL_CRS_VIEW_ARCHIVE); break; case 'Download': #$this->course_obj->setViewMode(IL_CRS_VIEW_ARCHIVE); $this->course_obj->setArchiveType(IL_CRS_ARCHIVE_DOWNLOAD); break; } break; case 'Disabled': $this->course_obj->setSubscriptionType(IL_CRS_SUBSCRIPTION_DEACTIVATED); break; case "MetaData": $this->in_meta_data = true; parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs); break; } }
/** * send all cached tags to the meta data parser and * clear the cache */ function emptyMediaMetaCache(&$a_xml_parser) { foreach ($this->media_meta_cache as $cache_entry) { switch ($cache_entry["type"]) { case "handlerBeginTag": parent::handlerBeginTag($a_xml_parser, $cache_entry["par1"], $cache_entry["par2"]); break; case "handlerEndTag": parent::handlerEndTag($a_xml_parser, $cache_entry["par1"]); break; case "handlerCharacterData": parent::handlerCharacterData($a_xml_parser, $cache_entry["par1"]); break; } } $this->media_meta_start = false; $this->media_meta_cache[] = array(); }