/** * 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')); }
/** * 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"); }
/** * 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(); }
/** * Init Form * * @access protected */ protected function initForm($a_mode) { if (is_object($this->form)) { return true; } $perm = $this->getPermissions()->hasPermissions(ilAdvancedMDPermissionHelper::CONTEXT_RECORD, $this->record->getRecordId(), array(array(ilAdvancedMDPermissionHelper::ACTION_RECORD_EDIT_PROPERTY, ilAdvancedMDPermissionHelper::SUBACTION_RECORD_TITLE), array(ilAdvancedMDPermissionHelper::ACTION_RECORD_EDIT_PROPERTY, ilAdvancedMDPermissionHelper::SUBACTION_RECORD_DESCRIPTION), array(ilAdvancedMDPermissionHelper::ACTION_RECORD_EDIT_PROPERTY, ilAdvancedMDPermissionHelper::SUBACTION_RECORD_OBJECT_TYPES), ilAdvancedMDPermissionHelper::ACTION_RECORD_TOGGLE_ACTIVATION)); include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); $this->form->setFormAction($this->ctrl->getFormAction($this)); // title $title = new ilTextInputGUI($this->lng->txt('title'), 'title'); $title->setValue($this->record->getTitle()); $title->setSize(20); $title->setMaxLength(70); $title->setRequired(true); $this->form->addItem($title); if (!$perm[ilAdvancedMDPermissionHelper::ACTION_RECORD_EDIT_PROPERTY][ilAdvancedMDPermissionHelper::SUBACTION_RECORD_TITLE]) { $title->setDisabled(true); } // desc $desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'desc'); $desc->setValue($this->record->getDescription()); $desc->setRows(3); $desc->setCols(50); $this->form->addItem($desc); if (!$perm[ilAdvancedMDPermissionHelper::ACTION_RECORD_EDIT_PROPERTY][ilAdvancedMDPermissionHelper::SUBACTION_RECORD_DESCRIPTION]) { $desc->setDisabled(true); } // active $check = new ilCheckboxInputGUI($this->lng->txt('md_adv_active'), 'active'); $check->setChecked($this->record->isActive()); $check->setValue(1); $this->form->addItem($check); if (!$perm[ilAdvancedMDPermissionHelper::ACTION_RECORD_TOGGLE_ACTIVATION]) { $check->setDisabled(true); } $section = new ilFormSectionHeaderGUI(); $section->setTitle($this->lng->txt('md_obj_types')); $this->form->addItem($section); foreach (ilAdvancedMDRecord::_getAssignableObjectTypes(true) as $type) { $t = $type["obj_type"] . ":" . $type["sub_type"]; $this->lng->loadLanguageModule($type["obj_type"]); $check = new ilCheckboxInputGUI($type["text"], 'obj_types[]'); $check->setChecked($this->record->isAssignedObjectType($type["obj_type"], $type["sub_type"])); $check->setValue($t); $this->form->addItem($check); if (!$perm[ilAdvancedMDPermissionHelper::ACTION_RECORD_EDIT_PROPERTY][ilAdvancedMDPermissionHelper::SUBACTION_RECORD_OBJECT_TYPES]) { $check->setDisabled(true); } } switch ($a_mode) { case 'create': $this->form->setTitle($this->lng->txt('md_adv_create_record')); $this->form->addCommandButton('saveRecord', $this->lng->txt('add')); $this->form->addCommandButton('showRecords', $this->lng->txt('cancel')); return true; case 'edit': $this->form->setTitle($this->lng->txt('md_adv_edit_record')); $this->form->addCommandButton('updateRecord', $this->lng->txt('save')); $this->form->addCommandButton('showRecords', $this->lng->txt('cancel')); return true; } }
/** * Init Form * * @access protected */ protected function initForm($a_mode) { if (is_object($this->form)) { return true; } include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); $this->form->setFormAction($this->ctrl->getFormAction($this)); // title $title = new ilTextInputGUI($this->lng->txt('title'), 'title'); $title->setValue($this->record->getTitle()); $title->setSize(20); $title->setMaxLength(70); $title->setRequired(true); $this->form->addItem($title); // desc $desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'desc'); $desc->setValue($this->record->getDescription()); $desc->setRows(3); $desc->setCols(50); $this->form->addItem($desc); // active $check = new ilCheckboxInputGUI($this->lng->txt('md_adv_active'), 'active'); $check->setChecked($this->record->isActive()); $check->setValue(1); $this->form->addItem($check); $section = new ilFormSectionHeaderGUI(); $section->setTitle($this->lng->txt('md_obj_types')); $this->form->addItem($section); foreach (ilAdvancedMDRecord::_getAssignableObjectTypes(true) as $type) { $t = $type["obj_type"] . ":" . $type["sub_type"]; $this->lng->loadLanguageModule($type["obj_type"]); $check = new ilCheckboxInputGUI($type["text"], 'obj_types[]'); $check->setChecked($this->record->isAssignedObjectType($type["obj_type"], $type["sub_type"])); $check->setValue($t); $this->form->addItem($check); } switch ($a_mode) { case 'create': $this->form->setTitle($this->lng->txt('md_adv_create_record')); $this->form->addCommandButton('saveRecord', $this->lng->txt('add')); $this->form->addCommandButton('showRecords', $this->lng->txt('cancel')); return true; case 'edit': $this->form->setTitle($this->lng->txt('md_adv_edit_record')); $this->form->addCommandButton('updateRecord', $this->lng->txt('save')); $this->form->addCommandButton('showRecords', $this->lng->txt('cancel')); return true; } }