/**
  * Fill row
  *
  * @access public
  * @param
  * 
  */
 public function fillRow($a_set)
 {
     foreach (ilAdvancedMDRecord::_getAssignableObjectTypes(true) as $obj_type) {
         $this->tpl->setCurrentBlock('ass_obj_types');
         $this->tpl->setVariable('VAL_OBJ_TYPE', $obj_type["text"]);
         $this->tpl->setVariable('ASS_ID', $a_set['id']);
         $this->tpl->setVariable('ASS_NAME', $obj_type["obj_type"] . ":" . $obj_type["sub_type"]);
         foreach ($a_set['obj_types'] as $t) {
             if ($obj_type["obj_type"] == $t["obj_type"] && $obj_type["sub_type"] == $t["sub_type"]) {
                 $this->tpl->setVariable('ASS_CHECKED', 'checked="checked"');
             }
         }
         $this->tpl->parseCurrentBlock();
     }
     $this->tpl->setVariable('VAL_ID', $a_set['id']);
     $this->tpl->setVariable('VAL_TITLE', $a_set['title']);
     if (strlen($a_set['description'])) {
         $this->tpl->setVariable('VAL_DESCRIPTION', $a_set['description']);
     }
     $defs = ilAdvancedMDFieldDefinition::_getDefinitionsByRecordId($a_set['id']);
     if (!count($defs)) {
         $this->tpl->setVariable('TXT_FIELDS', $this->lng->txt('md_adv_no_fields'));
     }
     foreach ($defs as $definition_obj) {
         $this->tpl->setCurrentBlock('field_entry');
         $this->tpl->setVariable('FIELD_NAME', $definition_obj->getTitle());
         $this->tpl->parseCurrentBlock();
     }
     $this->tpl->setVariable('ACTIVE_CHECKED', $a_set['active'] ? ' checked="checked" ' : '');
     $this->tpl->setVariable('ACTIVE_ID', $a_set['id']);
     $this->ctrl->setParameter($this->parent_obj, 'record_id', $a_set['id']);
     $this->tpl->setVariable('EDIT_LINK', $this->ctrl->getLinkTarget($this->parent_obj, 'editRecord'));
     $this->tpl->setVariable('TXT_EDIT_RECORD', $this->lng->txt('edit'));
 }
 protected function getActiveAdvMDRecords($a_id)
 {
     include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
     $active = array();
     foreach (ilAdvancedMDRecord::_getActivatedRecordsByObjectType("glo", "term") as $record_obj) {
         $active[] = $record_obj->getRecordId();
     }
     return array_intersect($active, ilAdvancedMDRecord::getObjRecSelection($a_id, "term"));
 }
 /**
  * generate xml
  *
  * @access public
  * 
  */
 public function write()
 {
     $this->buildHeader();
     $this->xmlStartTag('AdvancedMetaDataRecords');
     foreach ($this->record_ids as $record_id) {
         $record_obj = ilAdvancedMDRecord::_getInstanceByrecordId($record_id);
         $record_obj->toXML($this);
     }
     $this->xmlEndTag('AdvancedMetaDataRecords');
 }
 /**
  * Get all advanced metadata fields
  */
 function getAllFields()
 {
     $fields = array();
     include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
     $recs = ilAdvancedMDRecord::_getSelectedRecordsByObject("glo", $this->glo_id, "term");
     foreach ($recs as $record_obj) {
         include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
         foreach (ilAdvancedMDFieldDefinition::_getDefinitionsByRecordId($record_obj->getRecordId()) as $def) {
             $fields[$def->getFieldId()] = array("id" => $def->getFieldId(), "title" => $def->getTitle(), "type" => $def->getFieldType());
         }
     }
     return $fields;
 }
 function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
 {
     include_once "Services/AdvancedMetaData/classes/class.ilAdvancedMDParser.php";
     include_once "Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php";
     $parser = new ilAdvancedMDParser($a_id, $a_mapping);
     $parser->setXMLContent($a_xml);
     $parser->startParsing();
     // select records for object
     foreach ($parser->getRecordIds() as $obj_id => $sub_types) {
         // currently only supported for wikis and glossary
         if (!in_array(ilObject::_lookupType($obj_id), array("glo", "wiki"))) {
             continue;
         }
         foreach ($sub_types as $sub_type => $rec_ids) {
             ilAdvancedMDRecord::saveObjRecSelection($obj_id, $sub_type, array_unique($rec_ids), false);
         }
     }
 }
Example #6
0
 protected function findPages($a_list_id)
 {
     global $ilDB;
     $list_values = $this->getFieldValues($a_list_id);
     $wiki_id = $this->getPage()->getWikiId();
     $found_result = array();
     // only search in active fields
     $found_ids = null;
     $recs = ilAdvancedMDRecord::_getSelectedRecordsByObject("wiki", $wiki_id, "wpg");
     foreach ($recs as $record) {
         foreach (ilAdvancedMDFieldDefinition::getInstancesByRecordId($record->getRecordId(), true) as $field) {
             if (isset($list_values[$field->getFieldId()])) {
                 $field_form = ilADTFactory::getInstance()->getSearchBridgeForDefinitionInstance($field->getADTDefinition(), true, false);
                 $field->setSearchValueSerialized($field_form, $list_values[$field->getFieldId()]);
                 $found_pages = $field->searchSubObjects($field_form, $wiki_id, "wpg");
                 if (is_array($found_ids)) {
                     $found_ids = array_intersect($found_ids, $found_pages);
                 } else {
                     $found_ids = $found_pages;
                 }
             }
         }
     }
     if (sizeof($found_ids)) {
         $sql = "SELECT id,title FROM il_wiki_page" . " WHERE " . $ilDB->in("id", $found_ids, "", "integer") . " ORDER BY title";
         $set = $ilDB->query($sql);
         while ($row = $ilDB->fetchAssoc($set)) {
             $found_result[$row["id"]] = $row["title"];
         }
     }
     return $found_result;
 }
 /**
  * get options for field selection
  * @param array array of field objects
  * @access protected
  */
 protected function prepareFieldSelection($fields)
 {
     include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
     $options[0] = $this->lng->txt('ecs_ignore_field');
     foreach ($fields as $field) {
         $field = ilAdvancedMDFieldDefinition::_getInstanceByFieldId($field);
         $title = ilAdvancedMDRecord::_lookupTitle($field->getRecordId());
         $options[$field->getFieldId()] = $title . ': ' . $field->getTitle();
     }
     return $options;
 }
 /**
  * Extract id
  *
  * @access private
  * @param
  * 
  */
 private function extractRecordId($a_id_string)
 {
     // first lookup import id
     if ($record_id = ilAdvancedMDRecord::_lookupRecordIdByImportId($a_id_string)) {
         $this->record_exists = true;
         return $record_id;
     }
     return 0;
 }
 private function parseInfoPage()
 {
     include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
     foreach (ilAdvancedMDRecord::_getActivatedRecordsByObjectType($this->obj_type) as $record_obj) {
         $this->info->addSection($record_obj->getTitle());
         include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
         foreach (ilAdvancedMDFieldDefinition::_getDefinitionsByRecordId($record_obj->getRecordId()) as $def) {
             include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDValue.php';
             $value = ilAdvancedMDValue::_getInstance($this->obj_id, $def->getFieldId());
             switch ($def->getFieldType()) {
                 case ilAdvancedMDFieldDefinition::TYPE_TEXT:
                     if ($value->getValue()) {
                         $this->info->addProperty($def->getTitle(), $value->getValue());
                     }
                     break;
                 case ilAdvancedMDFieldDefinition::TYPE_SELECT:
                     if ($value->getValue()) {
                         $this->info->addProperty($def->getTitle(), $value->getValue());
                     }
                     break;
                 case ilAdvancedMDFieldDefinition::TYPE_DATE:
                     if ($value->getValue()) {
                         $this->info->addProperty($def->getTitle(), ilDatePresentation::formatDate(new ilDate($value->getValue(), IL_CAL_UNIX)));
                     }
                     break;
                 case ilAdvancedMDFieldDefinition::TYPE_DATETIME:
                     if ($value->getValue()) {
                         $this->info->addProperty($def->getTitle(), ilDatePresentation::formatDate(new ilDateTime($value->getValue(), IL_CAL_UNIX)));
                     }
                     break;
             }
         }
     }
 }
 /**
  * Read active sections
  */
 protected function readSections()
 {
     foreach ($this->getActiveFields() as $field_name => $translation) {
         switch ($field_name) {
             // Default section
             case 'lom_content':
                 $this->active_sections['default']['fields'][] = 'lom_content';
                 $this->active_sections['default']['name'] = '';
                 break;
             case 'general_offline':
                 $this->active_sections['default']['fields'][] = 'general_offline';
                 $this->active_sections['default']['name'] = '';
                 break;
             case 'lom_type':
                 $this->active_sections['default']['fields'][] = 'lom_type';
                 $this->active_sections['default']['name'] = '';
                 break;
                 // General
             // General
             case 'lom_language':
                 $this->active_sections['general']['fields'][] = 'lom_language';
                 $this->active_sections['general']['name'] = $this->lng->txt('meta_general');
                 break;
             case 'lom_keyword':
                 $this->active_sections['general']['fields'][] = 'lom_keyword';
                 $this->active_sections['general']['name'] = $this->lng->txt('meta_general');
                 break;
             case 'lom_coverage':
                 $this->active_sections['general']['fields'][] = 'lom_coverage';
                 $this->active_sections['general']['name'] = $this->lng->txt('meta_general');
                 break;
             case 'lom_structure':
                 $this->active_sections['general']['fields'][] = 'lom_structure';
                 $this->active_sections['general']['name'] = $this->lng->txt('meta_general');
                 break;
                 // Lifecycle
             // Lifecycle
             case 'lom_status':
                 $this->active_sections['lifecycle']['fields'][] = 'lom_status';
                 $this->active_sections['lifecycle']['name'] = $this->lng->txt('meta_lifecycle');
                 break;
             case 'lom_version':
                 $this->active_sections['lifecycle']['fields'][] = 'lom_version';
                 $this->active_sections['lifecycle']['name'] = $this->lng->txt('meta_lifecycle');
                 break;
             case 'lom_contribute':
                 $this->active_sections['lifecycle']['fields'][] = 'lom_contribute';
                 $this->active_sections['lifecycle']['name'] = $this->lng->txt('meta_lifecycle');
                 break;
                 // Technical
             // Technical
             case 'lom_format':
                 $this->active_sections['technical']['fields'][] = 'lom_format';
                 $this->active_sections['technical']['name'] = $this->lng->txt('meta_technical');
                 break;
             case 'lom_operating_system':
                 $this->active_sections['technical']['fields'][] = 'lom_operating_system';
                 $this->active_sections['technical']['name'] = $this->lng->txt('meta_technical');
                 break;
             case 'lom_browser':
                 $this->active_sections['technical']['fields'][] = 'lom_browser';
                 $this->active_sections['technical']['name'] = $this->lng->txt('meta_technical');
                 break;
                 // Education
             // Education
             case 'lom_interactivity':
                 $this->active_sections['education']['fields'][] = 'lom_interactivity';
                 $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
                 break;
             case 'lom_resource':
                 $this->active_sections['education']['fields'][] = 'lom_resource';
                 $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
                 break;
             case 'lom_level':
                 $this->active_sections['education']['fields'][] = 'lom_level';
                 $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
                 break;
             case 'lom_density':
                 $this->active_sections['education']['fields'][] = 'lom_density';
                 $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
                 break;
             case 'lom_user_role':
                 $this->active_sections['education']['fields'][] = 'lom_user_role';
                 $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
                 break;
             case 'lom_context':
                 $this->active_sections['education']['fields'][] = 'lom_context';
                 $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
                 break;
             case 'lom_difficulty':
                 $this->active_sections['education']['fields'][] = 'lom_difficulty';
                 $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
                 break;
                 // Rights
             // Rights
             case 'lom_costs':
                 $this->active_sections['rights']['fields'][] = 'lom_costs';
                 $this->active_sections['rights']['name'] = $this->lng->txt('meta_rights');
                 break;
             case 'lom_copyright':
                 $this->active_sections['rights']['fields'][] = 'lom_copyright';
                 $this->active_sections['rights']['name'] = $this->lng->txt('meta_rights');
                 break;
                 // Classification
             // Classification
             case 'lom_purpose':
                 $this->active_sections['classification']['fields'][] = 'lom_purpose';
                 $this->active_sections['classification']['name'] = $this->lng->txt('meta_classification');
                 break;
             case 'lom_taxon':
                 $this->active_sections['classification']['fields'][] = 'lom_taxon';
                 $this->active_sections['classification']['name'] = $this->lng->txt('meta_classification');
                 break;
             default:
                 if (substr($field_name, 0, 3) != 'adv') {
                     break;
                 }
                 // Advanced meta data
                 $field_id = substr($field_name, 4);
                 include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
                 include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
                 $field = ilAdvancedMDFieldDefinition::_getInstanceByFieldId($field_id);
                 $record_id = $field->getRecordId();
                 $this->active_sections['adv_record_' . $record_id]['fields'][] = $field_name;
                 $this->active_sections['adv_record_' . $record_id]['name'] = ilAdvancedMDRecord::_lookupTitle($record_id);
                 break;
         }
     }
 }
 /**
  * get client information from current as xml result set
  *
  * @param string $sid  current session id
  *
  * @return XMLResultSet containing columns installation_id, installation_version, installation_url, installation_description, installation_default_language
  */
 function getNIC($sid)
 {
     $this->initAuth($sid);
     $this->initIlias();
     if (!$this->__checkSession($sid)) {
         return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
     }
     global $rbacsystem, $rbacreview, $ilLog, $rbacadmin, $ilSetting, $ilClientIniFile;
     if (!is_object($ilClientIniFile)) {
         return $this->__raiseError("Client ini is not initialized", "Server");
     }
     $auth_modes = ilAuthUtils::_getActiveAuthModes();
     $auth_mode_default = strtoupper(ilAuthUtils::_getAuthModeName(array_shift($auth_modes)));
     $auth_mode_names = array();
     foreach ($auth_modes as $mode) {
         $auth_mode_names[] = strtoupper(ilAuthUtils::_getAuthModeName($mode));
     }
     include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
     include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordXMLWriter.php';
     // create advanced meta data record xml
     $record_ids = array();
     $record_types = ilAdvancedMDRecord::_getAssignableObjectTypes();
     foreach ($record_types as $type) {
         $records = ilAdvancedMDRecord::_getActivatedRecordsByObjectType($type);
         foreach ($records as $record) {
             $record_ids[] = $record->getRecordId();
         }
     }
     $record_ids = array_unique($record_ids);
     $advmwriter = new ilAdvancedMDRecordXMLWriter($record_ids);
     $advmwriter->write();
     // create user defined fields record xml, simulate empty user records
     include_once "./Services/User/classes/class.ilUserXMLWriter.php";
     $udfWriter = new ilUserXMLWriter();
     $users = array();
     $udfWriter->setObjects($users);
     $udfWriter->start();
     // todo: get information from client id, read from ini file specificied
     $client_details[] = array("installation_id" => IL_INST_ID, "installation_version" => ILIAS_VERSION, "installation_url" => ILIAS_HTTP_PATH, "installation_description" => $ilClientIniFile->readVariable("client", "description"), "installation_language_default" => $ilClientIniFile->readVariable("language", "default"), "installation_session_expire" => $ilClientIniFile->readVariable("session", "expire"), "installation_php_postmaxsize" => $this->return_bytes(ini_get("post_max_size")), "authentication_methods" => join(",", $auth_mode_names), "authentication_default_method" => $auth_mode_default, "installation_udf_xml" => $udfWriter->getXML(), "installation_advmd_xml" => $advmwriter->xmlDumpMem(false));
     // store into xml result set
     include_once './webservice/soap/classes/class.ilXMLResultSet.php';
     $xmlResult = new ilXMLResultSet();
     $xmlResult->addArray($client_details, true);
     // create writer and return xml
     include_once './webservice/soap/classes/class.ilXMLResultSetWriter.php';
     $xmlResultWriter = new ilXMLResultSetWriter($xmlResult);
     $xmlResultWriter->start();
     return $xmlResultWriter->getXML();
 }
 /**
  * Delete
  *
  * @access public
  * 
  */
 public function delete()
 {
     ilAdvancedMDRecord::_delete($this->getRecordId());
 }
 protected function setEditTabs($active_tab = "settings_misc")
 {
     $this->tabs_gui->addSubTab("settings_misc", $this->lng->txt("settings"), $this->ctrl->getLinkTarget($this, "edit"));
     $this->tabs_gui->addSubTab("settings_trans", $this->lng->txt("title_and_translations"), $this->ctrl->getLinkTarget($this, "editTranslations"));
     $this->tabs_gui->activateTab("settings");
     $this->tabs_gui->activateSubTab($active_tab);
     include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
     if (in_array('cat', ilAdvancedMDRecord::_getActivatedObjTypes())) {
         $this->tabs_gui->addSubTabTarget("edit_cat_settings", $this->ctrl->getLinkTarget($this, 'editInfo'), "editInfo", get_class($this));
     }
 }
 /**
  * Get and cache record objects 
  *
  * @access protected
  */
 protected function getRecordObjects()
 {
     if (!isset($this->record_objs)) {
         return $this->record_objs = ilAdvancedMDRecord::_getRecords();
     }
     return $this->record_objs;
 }
 /**
  * Add Advanced Meta Data Information to the Info Screen
  *
  * @param ilInfoScreenGUI $info
  */
 protected function parseInfoScreen(ilInfoScreenGUI $info)
 {
     include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php';
     include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
     include_once 'Services/ADT/classes/class.ilADTFactory.php';
     $type = $this->object->getOrgUnitType();
     if (!$type) {
         return;
     }
     $assigned_record_ids = $type->getAssignedAdvancedMDRecordIds();
     foreach (ilAdvancedMDValues::getInstancesForObjectId($this->object->getId(), 'orgu') as $record_id => $a_values) {
         // Skip record ids not assigned to the type
         if (!in_array($record_id, $assigned_record_ids)) {
             continue;
         }
         // Note that we have to do this because with the instances above the sub-type and sub-id are missing...
         $a_values = new ilAdvancedMDValues($record_id, $this->object->getId(), 'orgu_type', $this->object->getOrgUnitTypeId());
         // this correctly binds group and definitions
         $a_values->read();
         $info->addSection(ilAdvancedMDRecord::_lookupTitle($record_id));
         $defs = $a_values->getDefinitions();
         foreach ($a_values->getADTGroup()->getElements() as $element_id => $element) {
             if (!$element->isNull()) {
                 $info->addProperty($defs[$element_id]->getTitle(), ilADTFactory::getInstance()->getPresentationBridgeForInstance($element)->getHTML());
             }
         }
     }
 }
Example #16
0
 protected function setEditTabs($active_tab = "settings_misc")
 {
     global $ilSetting, $ilTabs;
     $this->tabs_gui->addSubTab("settings_misc", $this->lng->txt("settings"), $this->ctrl->getLinkTarget($this, "edit"));
     /*$this->tabs_gui->addSubTab("settings_trans",
     		$this->lng->txt("title_and_translations"),
     		$this->ctrl->getLinkTarget($this, "editTranslations"));*/
     $this->tabs_gui->addSubTab("settings_trans", $this->lng->txt("obj_multilinguality"), $this->ctrl->getLinkTargetByClass("ilobjecttranslationgui", ""));
     // custom icon
     if ($ilSetting->get("custom_icons")) {
         $this->tabs_gui->addSubTab("icons", $this->lng->txt("icon_settings"), $this->ctrl->getLinkTarget($this, 'editIcons'));
     }
     $this->tabs_gui->activateTab("settings");
     $this->tabs_gui->activateSubTab($active_tab);
     include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
     if (in_array('cat', ilAdvancedMDRecord::_getActivatedObjTypes())) {
         $this->tabs_gui->addSubTabTarget("edit_cat_settings", $this->ctrl->getLinkTarget($this, 'editInfo'), "editInfo", get_class($this));
     }
 }
Example #17
0
 public function update()
 {
     global $ilDB;
     parent::update();
     $sql = 'SELECT * FROM ' . self::TABLE_NAME . ' WHERE orgu_id = ' . $ilDB->quote($this->getId(), 'integer');
     $set = $ilDB->query($sql);
     if ($ilDB->numRows($set)) {
         $ilDB->update(self::TABLE_NAME, array('orgu_type_id' => array('integer', $this->getOrgUnitTypeId())), array('orgu_id' => array('integer', $this->getId())));
     } else {
         $ilDB->insert(self::TABLE_NAME, array('orgu_type_id' => array('integer', $this->getOrgUnitTypeId()), 'orgu_id' => array('integer', $this->getId())));
     }
     // Update selection for advanced meta data of the type
     if ($this->getOrgUnitTypeId()) {
         ilAdvancedMDRecord::saveObjRecSelection($this->getId(), 'orgu_type', $this->getOrgUnitType()->getAssignedAdvancedMDRecordIds());
     } else {
         // If no type is assigned, delete relations by passing an empty array
         ilAdvancedMDRecord::saveObjRecSelection($this->getId(), 'orgu_type', array());
     }
 }
 public static function getRecords($a_wiki_obj_id)
 {
     if (!array_key_exists($a_wiki_obj_id, self::$records)) {
         include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
         self::$records[$a_wiki_obj_id] = ilAdvancedMDRecord::_getSelectedRecordsByObject("wiki", $a_wiki_obj_id, "wpg");
     }
     return self::$records[$a_wiki_obj_id];
 }
 /**
  * Parse table cells
  */
 private function parseTableCells()
 {
     global $ilUser;
     $data = $this->getRowData();
     $html = "";
     include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
     if ($this->getSelectedOnly()) {
         $recs = ilAdvancedMDRecord::_getSelectedRecordsByObject($this->obj_type, $this->obj_id, $this->sub_type);
     } else {
         $recs = ilAdvancedMDRecord::_getActivatedRecordsByObjectType($this->obj_type, $this->sub_type);
     }
     foreach ($recs as $record_obj) {
         include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
         foreach (ilAdvancedMDFieldDefinition::_getDefinitionsByRecordId($record_obj->getRecordId()) as $def) {
             if ($this->handleECSDefinitions($def)) {
                 continue;
             }
             $html .= "<td class='std'>" . $data['md_' . $def->getFieldId()] . "</td>";
         }
     }
     return $html;
 }
 /**
  * create client tag
  *
  * @param ilSetting $setting
  */
 private function __buildClient($setting)
 {
     $auth_modes = ilAuthUtils::_getActiveAuthModes();
     $auth_mode_default = strtoupper(ilAuthUtils::_getAuthModeName(array_shift($auth_modes)));
     $auth_mode_names = array();
     foreach ($auth_modes as $mode) {
         $auth_mode_names[] = strtoupper(ilAuthUtils::_getAuthModeName($mode));
     }
     // determine skins/styles
     $skin_styles = array();
     include_once "./Services/Style/classes/class.ilStyleDefinition.php";
     $styleDefinition = new ilStyleDefinition();
     include_once "./Services/Style/classes/class.ilObjStyleSettings.php";
     $templates = $styleDefinition->getAllTemplates();
     if (is_array($templates)) {
         foreach ($templates as $template) {
             // get styles information of template
             $styleDef =& new ilStyleDefinition($template["id"]);
             $styleDef->startParsing();
             $styles = $styleDef->getStyles();
             foreach ($styles as $style) {
                 if (!ilObjStyleSettings::_lookupActivatedStyle($template["id"], $style["id"])) {
                     continue;
                 }
                 $skin_styles[] = $template["id"] . ":" . $style["id"];
             }
         }
     }
     // timezones
     include_once 'Services/Calendar/classes/class.ilTimeZone.php';
     $this->xmlStartTag("Client", array("inst_id" => $setting->get("inst_id"), "id" => $setting->clientid, "enabled" => $setting->access == 1 ? "TRUE" : "FALSE", "default_lang" => $setting->language));
     $this->xmlEndTag("Client");
     return;
     // END here due to security reasons.
     $this->xmlElement("Name", null, $setting->get("inst_name"));
     $this->xmlElement("Description", null, $setting->description);
     $this->xmlElement("Institution", null, $setting->get("inst_institution"));
     $this->xmlStartTag("Responsible");
     $this->xmlElement("Firstname", null, $setting->get("admin_firstname"));
     $this->xmlElement("Lastname", null, $setting->get("admin_lastname"));
     $this->xmlElement("Title", null, $setting->get("admin_title"));
     $this->xmlElement("Institution", null, $setting->get("admin_institution"));
     $this->xmlElement("Position", null, $setting->get("admin_position"));
     $this->xmlElement("Email", null, $setting->get("admin_email"));
     $this->xmlElement("Street ", null, $setting->get("admin_street"));
     $this->xmlElement("ZipCode ", null, $setting->get("admin_zipcode"));
     $this->xmlElement("City", null, $setting->get("admin_city"));
     $this->xmlElement("Country", null, $setting->get("admin_country"));
     $this->xmlElement("Phone", null, $setting->get("admin_phone"));
     $this->xmlEndTag("Responsible");
     $this->xmlStartTag("Settings");
     $this->xmlElement("Setting", array("key" => "error_recipient"), $setting->get("error_recipient"));
     $this->xmlElement("Setting", array("key" => "feedback_recipient"), $setting->get("feedback_recipient"));
     $this->xmlElement("Setting", array("key" => "session_expiration"), $setting->session);
     $this->xmlElement("Setting", array("key" => "soap_enabled"), $setting->get("soap_user_administration"));
     $this->xmlElement("Setting", array("key" => "authentication_methods"), join(",", $auth_mode_names));
     $this->xmlElement("Setting", array("key" => "authentication_default_method"), $auth_mode_default);
     $this->xmlElement("Setting", array("key" => "skins"), join(",", $skin_styles));
     $this->xmlElement("Setting", array("key" => "default_skin"), $setting->default_skin_style);
     $this->xmlElement("Setting", array("key" => "default_timezone"), ilTimeZone::_getDefaultTimeZone());
     $this->xmlElement("Setting", array("key" => "default_hits_per_page"), $setting->default_hits_per_page);
     $this->xmlElement("Setting", array("key" => "default_show_users_online"), $setting->default_show_users_online);
     $this->xmlEndTag("Settings");
     if ($this->exportAdvMDDefs) {
         // create advanced meta data record xml
         include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
         include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordXMLWriter.php';
         $record_ids = array();
         $record_types = ilAdvancedMDRecord::_getAssignableObjectTypes();
         foreach ($record_types as $type) {
             $records = ilAdvancedMDRecord::_getActivatedRecordsByObjectType($type);
             foreach ($records as $record) {
                 $record_ids[] = $record->getRecordId();
             }
         }
         $record_ids = array_unique($record_ids);
         $this->xmlStartTag('AdvancedMetaDataRecords');
         if (count($record_ids) > 0) {
             foreach ($record_ids as $record_id) {
                 $record_obj = ilAdvancedMDRecord::_getInstanceByrecordId($record_id);
                 $record_obj->toXML($this);
             }
         }
         $this->xmlEndTag('AdvancedMetaDataRecords');
     }
     if ($this->exportUDFDefs) {
         // create user defined fields record xml
         include_once "./Services/User/classes/class.ilUserDefinedFields.php";
         $udf_data =& ilUserDefinedFields::_newInstance();
         $udf_data->addToXML($this);
     }
     $this->xmlEndTag("Client");
 }
 /**
  * Query data for given object records
  *
  * @param
  * @return
  */
 public static function queryForRecords($a_obj_id, $a_subtype, $a_records, $a_obj_id_key, $a_obj_subid_key, array $a_amet_filter = null)
 {
     $result = array();
     if (!is_array($a_obj_id)) {
         $a_obj_id = array($a_obj_id);
     }
     $sub_obj_ids = array();
     foreach ($a_records as $rec) {
         $sub_obj_ids[] = $rec[$a_obj_subid_key];
     }
     // preload adv data for object id(s)
     ilADTFactory::getInstance()->initActiveRecordByType();
     ilADTActiveRecordByType::preloadByPrimary("adv_md_values", array("obj_id" => array("integer", $a_obj_id), "sub_type" => array("text", $a_subtype), "sub_id" => array("integer", $sub_obj_ids)));
     $record_groups = array();
     foreach ($a_records as $rec) {
         $obj_id = $rec[$a_obj_id_key];
         $sub_id = $rec[$a_obj_subid_key];
         // only active amet records for glossary
         foreach (ilAdvancedMDRecord::_getSelectedRecordsByObject(ilObject::_lookupType($obj_id), $obj_id, $a_subtype) as $adv_record) {
             $record_id = $adv_record->getRecordId();
             if (!isset($record_groups[$record_id])) {
                 $defs = ilAdvancedMDFieldDefinition::getInstancesByRecordId($record_id);
                 $record_groups[$record_id] = ilAdvancedMDFieldDefinition::getADTGroupForDefinitions($defs);
                 $record_groups[$record_id] = ilADTFactory::getInstance()->getDBBridgeForInstance($record_groups[$record_id]);
                 $record_groups[$record_id]->setTable("adv_md_values");
             }
             // prepare ADT group for record id
             $record_groups[$record_id]->setPrimary(array("obj_id" => array("integer", $obj_id), "sub_type" => array("text", $a_subtype), "sub_id" => array("integer", $sub_id)));
             // multi-enum fakes single in adv md
             foreach ($record_groups[$record_id]->getElements() as $element) {
                 if ($element->getADT()->getType() == "MultiEnum") {
                     $element->setFakeSingle(true);
                 }
             }
             // read (preloaded) data
             $active_record = new ilADTActiveRecordByType($record_groups[$record_id]);
             $active_record->setElementIdColumn("field_id", "integer");
             $active_record->read();
             $adt_group = $record_groups[$record_id]->getADT();
             // filter against amet values
             if ($a_amet_filter) {
                 foreach ($a_amet_filter as $field_id => $element) {
                     if ($adt_group->hasElement($field_id)) {
                         if (!$element->isInCondition($adt_group->getElement($field_id))) {
                             continue 3;
                         }
                     }
                 }
             }
             // add amet values to glossary term record
             foreach ($adt_group->getElements() as $element_id => $element) {
                 if (!$element->isNull()) {
                     // we are reusing the ADT group for all $a_records, so we need to clone
                     $pb = ilADTFactory::getInstance()->getPresentationBridgeForInstance(clone $element);
                     $rec["md_" . $element_id] = $pb->getSortable();
                     $rec["md_" . $element_id . "_presentation"] = $pb;
                 } else {
                     $rec["md_" . $element_id] = null;
                 }
             }
         }
         $results[] = $rec;
     }
     return $results;
 }
Example #22
0
 /**
  * Deassign a given AdvancedMD record from this type.
  *
  * @param int $a_record_id
  *
  * @throws ilOrgUnitTypePluginException
  */
 public function deassignAdvancedMdRecord($a_record_id)
 {
     $record_ids = $this->getAssignedAdvancedMDRecordIds();
     $key = array_search($a_record_id, $record_ids);
     if ($key !== false) {
         /** @var ilOrgUnitTypeHookPlugin $plugin */
         $disallowed = array();
         $titles = array();
         foreach ($this->getActivePlugins() as $plugin) {
             if (!$plugin->allowDeassignAdvancedMDRecord($this->getId(), $a_record_id)) {
                 $disallowed[] = $plugin;
                 $titles[] = $plugin->getPluginName();
             }
         }
         if (count($disallowed)) {
             $msg = sprintf($this->lng->txt('orgu_type_msg_deassign_amd_prevented'), implode(', ', $titles));
             throw new ilOrgUnitTypePluginException($msg, $disallowed);
         }
         unset($record_ids[$key]);
         $sql = 'DELETE FROM orgu_types_adv_md_rec
                 WHERE type_id = ' . $this->db->quote($this->getId(), 'integer') . '
                 AND rec_id = ' . $this->db->quote($a_record_id, 'integer');
         $this->db->query($sql);
         // We need to update each OrgUnit from this type and map the selected records to object_id
         foreach ($this->getOrgUnitIds() as $orgu_id) {
             ilAdvancedMDRecord::saveObjRecSelection($orgu_id, 'orgu_type', $record_ids);
         }
         $this->amd_records_assigned = NULL;
         // Force reload of assigned objects
     }
 }
 function __setSearchOptions(&$post_vars)
 {
     if (isset($_POST['cmd']['performSearch'])) {
         $this->options = $_SESSION['search_adv'] = $_POST['query'];
     } elseif (isset($_POST['cmd']['performAdvMDSearch'])) {
         $this->options = $_SESSION['search_adv_md'] = $_POST;
     } else {
         $this->options = $_SESSION['search_adv'];
     }
     $_POST['result'] = $_POST['id'];
     $this->filter = array();
     $this->options['type'] = 'all';
     switch ($this->options['type']) {
         case 'cat':
             $this->filter[] = 'cat';
             break;
         case 'webr':
             $this->filter[] = 'webr';
             break;
         case 'lms':
             $this->filter[] = 'lm';
             $this->filter[] = 'dbk';
             $this->filter[] = 'pg';
             $this->filter[] = 'st';
             $this->filter[] = 'sahs';
             $this->filter[] = 'htlm';
             break;
         case 'glo':
             $this->filter[] = 'glo';
             break;
         case 'tst':
             $this->filter[] = 'tst';
             $this->filter[] = 'svy';
             $this->filter[] = 'qpl';
             $this->filter[] = 'spl';
             break;
         case 'mep':
             $this->filter[] = 'mep';
             break;
         case 'crs':
             $this->filter[] = 'crs';
             break;
         case 'file':
             $this->filter[] = 'file';
             break;
         case 'adv_all':
             include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
             $this->filter = ilAdvancedMDRecord::_getActivatedObjTypes();
             break;
         case 'all':
         default:
             $this->filter[] = 'webr';
             $this->filter[] = 'crs';
             $this->filter[] = 'mep';
             $this->filter[] = 'tst';
             $this->filter[] = 'svy';
             $this->filter[] = 'qpl';
             $this->filter[] = 'spl';
             $this->filter[] = 'glo';
             $this->filter[] = 'lm';
             $this->filter[] = 'dbk';
             $this->filter[] = 'pg';
             $this->filter[] = 'st';
             $this->filter[] = 'sahs';
             $this->filter[] = 'htlm';
             $this->filter[] = 'file';
     }
     return true;
 }