/** * Build export file * * @param * @return */ function buildExportFile() { global $ilias; // create export file include_once "./Services/Export/classes/class.ilExport.php"; ilExport::_createExportDirectory($this->object->getId(), "html", "prtf"); $exp_dir = ilExport::_getExportDirectory($this->object->getId(), "html", "prtf"); $this->subdir = $this->object->getType() . "_" . $this->object->getId(); $this->export_dir = $exp_dir . "/" . $this->subdir; // initialize temporary target directory ilUtil::delDir($this->export_dir); ilUtil::makeDir($this->export_dir); // system style html exporter include_once "./Services/Style/classes/class.ilSystemStyleHTMLExport.php"; $this->sys_style_html_export = new ilSystemStyleHTMLExport($this->export_dir); // $this->sys_style_html_export->addImage("icon_prtf_b.png"); $this->sys_style_html_export->export(); // init co page html exporter include_once "./Services/COPage/classes/class.ilCOPageHTMLExport.php"; $this->co_page_html_export = new ilCOPageHTMLExport($this->export_dir); /* $this->co_page_html_export->setContentStyleId( $this->object->getStyleSheetId()); */ $this->co_page_html_export->createDirectories(); $this->co_page_html_export->exportStyles(); $this->co_page_html_export->exportSupportScripts(); // banner / profile picture $prfa_set = new ilSetting("prfa"); if ($prfa_set->get("banner")) { $banner = $this->object->getImageFullPath(); copy($banner, $this->export_dir . "/" . basename($banner)); } $ppic = ilObjUser::_getPersonalPicturePath($this->object->getOwner(), "big"); if ($ppic) { $ppic = array_shift(explode("?", $ppic)); copy($ppic, $this->export_dir . "/" . basename($ppic)); } // export pages $this->exportHTMLPages(); // zip everything if (true) { // zip it all $date = time(); $zip_file = ilExport::_getExportDirectory($this->object->getId(), "html", "prtf") . "/" . $date . "__" . IL_INST_ID . "__" . $this->object->getType() . "_" . $this->object->getId() . ".zip"; ilUtil::zip($this->export_dir, $zip_file); ilUtil::delDir($this->export_dir); } return $zip_file; }
/** * Standard Version of Fill Row. Most likely to * be overwritten by derived class. */ protected function fillRow($a_set) { global $lng, $ilCtrl, $ilAccess; // rollback command if ($a_set["nr"] > 0) { $ilCtrl->setParameter($this->getParentObject(), "old_nr", $a_set["nr"]); $this->tpl->setCurrentBlock("command"); $this->tpl->setVariable("TXT_COMMAND", $lng->txt("cont_rollback")); $this->tpl->setVariable("HREF_COMMAND", $ilCtrl->getLinkTarget($this->getParentObject(), "rollbackConfirmation")); $this->tpl->parseCurrentBlock(); $ilCtrl->setParameter($this->getParentObject(), "old_nr", ""); } if (!$this->rselect) { $this->tpl->setVariable("RSELECT", 'checked="checked"'); $this->rselect = true; } else { if (!$this->lselect) { $this->tpl->setVariable("LSELECT", 'checked="checked"'); $this->lselect = true; } } $this->tpl->setVariable("NR", $a_set["nr"]); $this->tpl->setVariable("TXT_HDATE", ilDatePresentation::formatDate(new ilDateTime($a_set["hdate"], IL_CAL_DATETIME))); $ilCtrl->setParameter($this->getParentObject(), "old_nr", $a_set["nr"]); $this->tpl->setVariable("HREF_OLD_PAGE", $ilCtrl->getLinkTarget($this->getParentObject(), "preview")); if (ilObject::_exists($a_set["user"])) { // user name $user = ilObjUser::_lookupName($a_set["user"]); $login = ilObjUser::_lookupLogin($a_set["user"]); $this->tpl->setVariable("TXT_LINKED_USER", $user["lastname"] . ", " . $user["firstname"] . " [" . $login . "]"); // profile link $ilCtrl->setParameterByClass("ilpublicuserprofilegui", "user", $a_set["user"]); $ilCtrl->setParameterByClass("ilpublicuserprofilegui", "back_url", rawurlencode($ilCtrl->getLinkTarget($this->getParentObject(), $this->getParentCmd()))); $this->tpl->setVariable("USER_LINK", $ilCtrl->getLinkTargetByClass("ilpublicuserprofilegui", "getHTML")); $img = ilObjUser::_getPersonalPicturePath($a_set["user"], "xxsmall", true); $this->tpl->setVariable("IMG_USER", $img); } $ilCtrl->setParameter($this->getParentObject(), "old_nr", ""); }
/** * Add standard fields to form */ function addStandardFieldsToForm($a_form, $a_user = NULL, array $custom_fields = NULL) { global $ilSetting, $lng, $rbacreview, $ilias; // custom registration settings if (self::$mode == self::MODE_REGISTRATION) { include_once 'Services/Registration/classes/class.ilRegistrationSettings.php'; $registration_settings = new ilRegistrationSettings(); self::$user_field["username"]["group"] = "login_data"; self::$user_field["password"]["group"] = "login_data"; self::$user_field["language"]["default"] = $lng->lang_key; // different position for role $roles = self::$user_field["roles"]; unset(self::$user_field["roles"]); self::$user_field["roles"] = $roles; self::$user_field["roles"]["group"] = "settings"; } $fields = $this->getStandardFields(); $current_group = ""; $custom_fields_done = false; foreach ($fields as $f => $p) { // next group? -> diplay subheader if ($p["group"] != $current_group && ilUserProfile::userSettingVisible($f)) { if (is_array($custom_fields) && !$custom_fields_done) { // should be appended to "other" or at least before "settings" if ($current_group == "other" || $p["group"] == "settings") { // add "other" subheader if ($current_group != "other") { $sh = new ilFormSectionHeaderGUI(); $sh->setTitle($lng->txt("other")); $a_form->addItem($sh); } foreach ($custom_fields as $custom_field) { $a_form->addItem($custom_field); } $custom_fields_done = true; } } $sh = new ilFormSectionHeaderGUI(); $sh->setTitle($lng->txt($p["group"])); $a_form->addItem($sh); $current_group = $p["group"]; } $m = ""; if (isset($p["method"])) { $m = $p["method"]; } $lv = isset($p["lang_var"]) && $p["lang_var"] != "" ? $p["lang_var"] : $f; switch ($p["input"]) { case "login": if ((int) $ilSetting->get('allow_change_loginname') || self::$mode == self::MODE_REGISTRATION) { $val = new ilTextInputGUI($lng->txt('username'), 'username'); if ($a_user) { $val->setValue($a_user->getLogin()); } $val->setMaxLength(32); $val->setSize(40); $val->setRequired(true); } else { // user account name $val = new ilNonEditableValueGUI($lng->txt("username"), 'ne_un'); if ($a_user) { $val->setValue($a_user->getLogin()); } } $a_form->addItem($val); break; case "text": if (ilUserProfile::userSettingVisible($f)) { $ti = new ilTextInputGUI($lng->txt($lv), "usr_" . $f); if ($a_user) { $ti->setValue($a_user->{$m}()); } $ti->setMaxLength($p["maxlength"]); $ti->setSize($p["size"]); $ti->setRequired($ilSetting->get("require_" . $f)); if (!$ti->getRequired() || $ti->getValue()) { $ti->setDisabled($ilSetting->get("usr_settings_disable_" . $f)); } $a_form->addItem($ti); } break; case "sel_country": if (ilUserProfile::userSettingVisible($f)) { include_once "./Services/Form/classes/class.ilCountrySelectInputGUI.php"; $ci = new ilCountrySelectInputGUI($lng->txt($lv), "usr_" . $f); if ($a_user) { $ci->setValue($a_user->{$m}()); } $ci->setRequired($ilSetting->get("require_" . $f)); if (!$ci->getRequired() || $ci->getValue()) { $ci->setDisabled($ilSetting->get("usr_settings_disable_" . $f)); } $a_form->addItem($ci); } break; case "birthday": if (ilUserProfile::userSettingVisible($f)) { $bi = new ilBirthdayInputGUI($lng->txt($lv), "usr_" . $f); include_once "./Services/Calendar/classes/class.ilDateTime.php"; $date = null; if ($a_user && strlen($a_user->{$m}())) { $date = new ilDateTime($a_user->{$m}(), IL_CAL_DATE); $bi->setDate($date); } $bi->setShowEmpty(true); $bi->setStartYear(1900); $bi->setRequired($ilSetting->get("require_" . $f)); if (!$bi->getRequired() || $date) { $bi->setDisabled($ilSetting->get("usr_settings_disable_" . $f)); } $a_form->addItem($bi); } break; case "radio": if (ilUserProfile::userSettingVisible($f)) { $rg = new ilRadioGroupInputGUI($lng->txt($lv), "usr_" . $f); if ($a_user) { $rg->setValue($a_user->{$m}()); } foreach ($p["values"] as $k => $v) { $op = new ilRadioOption($lng->txt($v), $k); $rg->addOption($op); } $rg->setRequired($ilSetting->get("require_" . $f)); if (!$rg->getRequired() || $rg->getValue()) { $rg->setDisabled($ilSetting->get("usr_settings_disable_" . $f)); } $a_form->addItem($rg); } break; case "picture": if (ilUserProfile::userSettingVisible("upload") && $a_user) { $ii = new ilImageFileInputGUI($lng->txt("personal_picture"), "userfile"); $ii->setDisabled($ilSetting->get("usr_settings_disable_upload")); $upload = $a_form->getFileUpload("userfile"); if ($upload["name"]) { $ii->setPending($upload["name"]); } else { $im = ilObjUser::_getPersonalPicturePath($a_user->getId(), "small", true, true); if ($im != "") { $ii->setImage($im); $ii->setAlt($lng->txt("personal_picture")); } } // ilinc link as info if (ilUserProfile::userSettingVisible("upload") and $ilSetting->get("ilinc_active")) { include_once './Modules/ILinc/classes/class.ilObjiLincUser.php'; $ilinc_user = new ilObjiLincUser($a_user); if ($ilinc_user->id) { include_once './Modules/ILinc/classes/class.ilnetucateXMLAPI.php'; $ilincAPI = new ilnetucateXMLAPI(); $ilincAPI->uploadPicture($ilinc_user); $response = $ilincAPI->sendRequest("uploadPicture"); // return URL to user's personal page $url = trim($response->data['url']['cdata']); $desc = $lng->txt("ilinc_upload_pic_text") . " " . '<a href="' . $url . '">' . $lng->txt("ilinc_upload_pic_linktext") . '</a>'; $ii->setInfo($desc); } } $a_form->addItem($ii); } break; case "roles": if (self::$mode == self::MODE_DESKTOP) { if (ilUserProfile::userSettingVisible("roles")) { $global_roles = $rbacreview->getGlobalRoles(); foreach ($global_roles as $role_id) { if (in_array($role_id, $rbacreview->assignedRoles($a_user->getId()))) { $roleObj = $ilias->obj_factory->getInstanceByObjId($role_id); $role_names .= $roleObj->getTitle() . ", "; unset($roleObj); } } $dr = new ilNonEditableValueGUI($lng->txt("default_roles"), "ne_dr"); $dr->setValue(substr($role_names, 0, -2)); $a_form->addItem($dr); } } else { if (self::$mode == self::MODE_REGISTRATION) { if ($registration_settings->roleSelectionEnabled()) { include_once "./Services/AccessControl/classes/class.ilObjRole.php"; $options = array(); foreach (ilObjRole::_lookupRegisterAllowed() as $role) { $options[$role["id"]] = $role["title"]; } // registration form validation will take care of missing field / value if ($options) { if (sizeof($options) > 1) { $ta = new ilSelectInputGUI($lng->txt('default_role'), "usr_" . $f); $ta->setOptions($options); $ta->setRequired($ilSetting->get("require_" . $f)); if (!$ta->getRequired()) { $ta->setDisabled($ilSetting->get("usr_settings_disable_" . $f)); } } else { $ta = new ilHiddenInputGUI("usr_" . $f); $ta->setValue(array_shift(array_keys($options))); } $a_form->addItem($ta); } } } } break; case "email": if (ilUserProfile::userSettingVisible($f)) { $em = new ilEMailInputGUI($lng->txt($lv), "usr_" . $f); if ($a_user) { $em->setValue($a_user->{$m}()); } $em->setRequired($ilSetting->get("require_" . $f)); if (!$em->getRequired() || $em->getValue()) { $em->setDisabled($ilSetting->get("usr_settings_disable_" . $f)); } if (self::MODE_REGISTRATION == self::$mode) { $em->setRetype(true); } $a_form->addItem($em); } break; case "textarea": if (ilUserProfile::userSettingVisible($f)) { $ta = new ilTextAreaInputGUI($lng->txt($lv), "usr_" . $f); if ($a_user) { $ta->setValue($a_user->{$m}()); } $ta->setRows($p["rows"]); $ta->setCols($p["cols"]); $ta->setRequired($ilSetting->get("require_" . $f)); if (!$ta->getRequired() || $ta->getValue()) { $ta->setDisabled($ilSetting->get("usr_settings_disable_" . $f)); } $a_form->addItem($ta); } break; case "messenger": if (ilUserProfile::userSettingVisible("instant_messengers")) { $im_arr = $p["types"]; foreach ($im_arr as $im_name) { $im = new ilTextInputGUI($lng->txt("im_" . $im_name), "usr_im_" . $im_name); if ($a_user) { $im->setValue($a_user->getInstantMessengerId($im_name)); } $im->setMaxLength($p["maxlength"]); $im->setSize($p["size"]); $im->setRequired($ilSetting->get("require_" . "instant_messengers")); if (!$im->getRequired() || $im->getValue()) { $im->setDisabled($ilSetting->get("usr_settings_disable_" . "instant_messengers")); } $a_form->addItem($im); } } break; case "password": if (self::$mode == self::MODE_REGISTRATION) { if (!$registration_settings->passwordGenerationEnabled()) { $ta = new ilPasswordInputGUI($lng->txt($lv), "usr_" . $f); $ta->setRequired(true); // $ta->setDisabled($ilSetting->get("usr_settings_disable_".$f)); } else { $ta = new ilNonEditableValueGUI($lng->txt($lv)); $ta->setValue($lng->txt("reg_passwd_via_mail")); } $a_form->addItem($ta); } break; case "language": if (ilUserProfile::userSettingVisible($f)) { $ta = new ilSelectInputGUI($lng->txt($lv), "usr_" . $f); if ($a_user) { $ta->setValue($a_user->{$m}()); } $options = array(); $lng->loadLanguageModule("meta"); foreach ($lng->getInstalledLanguages() as $lang_key) { $options[$lang_key] = $lng->txt("meta_l_" . $lang_key); } asort($options); // #9728 $ta->setOptions($options); $ta->setRequired($ilSetting->get("require_" . $f)); if (!$ta->getRequired() || $ta->getValue()) { $ta->setDisabled($ilSetting->get("usr_settings_disable_" . $f)); } $a_form->addItem($ta); } break; case "multitext": if (ilUserProfile::userSettingVisible($f)) { $ti = new ilTextInputGUI($lng->txt($lv), "usr_" . $f); $ti->setMulti(true); if ($a_user) { $ti->setValue($a_user->{$m}()); } $ti->setMaxLength($p["maxlength"]); $ti->setSize($p["size"]); $ti->setRequired($ilSetting->get("require_" . $f)); if (!$ti->getRequired() || $ti->getValue()) { $ti->setDisabled($ilSetting->get("usr_settings_disable_" . $f)); } if ($this->ajax_href) { // add field to ajax call $ti->setDataSource($this->ajax_href . "&f=" . $f); } $a_form->addItem($ti); } break; } } // append custom fields as "other" if (is_array($custom_fields) && !$custom_fields_done) { // add "other" subheader if ($current_group != "other") { $sh = new ilFormSectionHeaderGUI(); $sh->setTitle($lng->txt("other")); $a_form->addItem($sh); } foreach ($custom_fields as $custom_field) { $a_form->addItem($custom_field); } } }
function renderTitle() { global $tpl; $tpl->resetHeaderBlock(); include_once "./Services/User/classes/class.ilUserUtil.php"; $tpl->setTitle(ilUserUtil::getNamePresentation($this->getUserId())); $tpl->setTitleIcon(ilObjUser::_getPersonalPicturePath($this->getUserId(), "xxsmall")); $this->handleBackUrl(); }
/** * Add fields to form * * @param ilPropertyformGUI $form * @param array $prefs * @param object $parent * @param bool $a_anonymized */ public function showPublicProfileFields(ilPropertyformGUI $form, array $prefs, $parent = null, $anonymized = false) { global $ilUser; $birthday = $ilUser->getBirthday(); if ($birthday) { $birthday = ilDatePresentation::formatDate(new ilDate($birthday, IL_CAL_DATE)); } $gender = $ilUser->getGender(); if ($gender) { $gender = $this->lng->txt("gender_" . $gender); } if ($ilUser->getSelectedCountry() != "") { $this->lng->loadLanguageModule("meta"); $txt_sel_country = $this->lng->txt("meta_c_" . $ilUser->getSelectedCountry()); } // profile picture $pic = ilObjUser::_getPersonalPicturePath($ilUser->getId(), "xsmall", true, true); if ($pic) { $pic = "<img src=\"" . $pic . "\" />"; } // personal data $val_array = array("title" => $ilUser->getUTitle(), "birthday" => $birthday, "gender" => $gender, "upload" => $pic, "interests_general" => $ilUser->getGeneralInterestsAsText(), "interests_help_offered" => $ilUser->getOfferingHelpAsText(), "interests_help_looking" => $ilUser->getLookingForHelpAsText(), "institution" => $ilUser->getInstitution(), "department" => $ilUser->getDepartment(), "street" => $ilUser->getStreet(), "zipcode" => $ilUser->getZipcode(), "city" => $ilUser->getCity(), "country" => $ilUser->getCountry(), "sel_country" => $txt_sel_country, "phone_office" => $ilUser->getPhoneOffice(), "phone_home" => $ilUser->getPhoneHome(), "phone_mobile" => $ilUser->getPhoneMobile(), "fax" => $ilUser->getFax(), "email" => $ilUser->getEmail(), "hobby" => $ilUser->getHobby(), "matriculation" => $ilUser->getMatriculation(), "delicious" => $ilUser->getDelicious()); // location include_once "./Services/Maps/classes/class.ilMapUtil.php"; if (ilMapUtil::isActivated()) { $val_array["location"] = ""; } foreach ($val_array as $key => $value) { if ($anonymized) { $value = null; } if ($this->userSettingVisible($key)) { // public setting if ($key == "upload") { $cb = new ilCheckboxInputGUI($this->lng->txt("personal_picture"), "chk_" . $key); } else { $cb = new ilCheckboxInputGUI($this->lng->txt($key), "chk_" . $key); } if ($prefs["public_" . $key] == "y") { $cb->setChecked(true); } //$cb->setInfo($value); $cb->setOptionTitle($value); if (!$parent) { $form->addItem($cb); } else { $parent->addSubItem($cb); } } } $im_arr = array("icq", "yahoo", "msn", "aim", "skype", "jabber", "voip"); if ($this->userSettingVisible("instant_messengers")) { foreach ($im_arr as $im) { // public setting $cb = new ilCheckboxInputGUI($this->lng->txt("im_" . $im), "chk_im_" . $im); //$cb->setInfo($ilUser->getInstantMessengerId($im)); $cb->setOptionTitle($ilUser->getInstantMessengerId($im)); if ($prefs["public_im_" . $im] != "n") { $cb->setChecked(true); } if (!$parent) { $form->addItem($cb); } else { $parent->addSubItem($cb); } } } // additional defined user data fields $user_defined_data = array(); if (!$anonymized) { $user_defined_data = $ilUser->getUserDefinedData(); } foreach ($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition) { // public setting $cb = new ilCheckboxInputGUI($definition["field_name"], "chk_udf_" . $definition["field_id"]); $cb->setOptionTitle($user_defined_data["f_" . $definition["field_id"]]); if ($prefs["public_udf_" . $definition["field_id"]] == "y") { $cb->setChecked(true); } if (!$parent) { $form->addItem($cb); } else { $parent->addSubItem($cb); } } }
/** * Default behaviour is: * - lastname, firstname if public profile enabled * - [loginname] (always) * modifications by jposselt at databay . de : * if $a_user_id is an array of user ids the method returns an array of * "id" => "NamePresentation" pairs. * * ... * @param boolean sortable should be used in table presentions. output is "Doe, John" title is ommited */ static function getNamePresentation($a_user_id, $a_user_image = false, $a_profile_link = false, $a_profile_back_link = "", $a_force_first_lastname = false, $a_omit_login = false, $a_sortable = true) { global $lng, $ilCtrl, $ilDB; if (!($return_as_array = is_array($a_user_id))) { $a_user_id = array($a_user_id); } $sql = 'SELECT a.usr_id, firstname, lastname, title, login, b.value public_profile, c.value public_title FROM usr_data a LEFT JOIN usr_pref b ON (a.usr_id = b.usr_id AND b.keyword = %s) LEFT JOIN usr_pref c ON (a.usr_id = c.usr_id AND c.keyword = %s) WHERE ' . $ilDB->in('a.usr_id', $a_user_id, false, 'integer'); $userrow = $ilDB->queryF($sql, array('text', 'text'), array('public_profile', 'public_title')); $names = array(); while ($row = $ilDB->fetchObject($userrow)) { if ($a_force_first_lastname || ($has_public_profile = in_array($row->public_profile, array("y", "g")))) { $title = ""; if ($row->public_title == "y" && $row->title) { $title = $row->title . " "; } if ($a_sortable) { $pres = $row->lastname; if (strlen($row->firstname)) { $pres .= ', ' . $row->firstname . ' '; } } else { $pres = $title; if (strlen($row->firstname)) { $pres .= $row->firstname . ' '; } $pres .= $row->lastname . ' '; } } if (!$a_omit_login) { $pres .= "[" . $row->login . "]"; } if ($a_profile_link && $has_public_profile) { $ilCtrl->setParameterByClass("ilpublicuserprofilegui", "user_id", $row->usr_id); if ($a_profile_back_link != "") { $ilCtrl->setParameterByClass("ilpublicuserprofilegui", "back_url", rawurlencode($a_profile_back_link)); } $pres = '<a href="' . $ilCtrl->getLinkTargetByClass("ilpublicuserprofilegui", "getHTML") . '">' . $pres . '</a>'; } if ($a_user_image) { $img = ilObjUser::_getPersonalPicturePath($row->usr_id, "xxsmall"); $pres = '<img border="0" src="' . $img . '" alt="' . $lng->txt("icon") . " " . $lng->txt("user_picture") . '" /> ' . $pres; } $names[$row->usr_id] = $pres; } foreach ($a_user_id as $id) { if (!$names[$id]) { $names[$id] = "unknown"; } } return $return_as_array ? $names : $names[$a_user_id[0]]; }
/** * Get path to personal picture. The result will be cached. * The result will be cached. * * @param string $a_size "small", "xsmall" or "xxsmall" * @param bool $a_force_pic * @return mixed */ public function getPersonalPicturePath($a_size = "small", $a_force_pic = false) { if (isset(self::$personal_image_cache[$this->getId()][$a_size][(int) $a_force_pic])) { return self::$personal_image_cache[$this->getId()][$a_size][(int) $a_force_pic]; } self::$personal_image_cache[$this->getId()][$a_size][(int) $a_force_pic] = ilObjUser::_getPersonalPicturePath($this->getId(), $a_size, $a_force_pic); return self::$personal_image_cache[$this->getId()][$a_size][(int) $a_force_pic]; }
function __showEditUser($a_user_id, $a_ref_id, $a_cancel, $a_sub_id = false) { global $ilObjDataCache, $lng, $ilCtrl; include_once 'Services/Tracking/classes/class.ilLPMarks.php'; if (!$a_sub_id) { $obj_id = $ilObjDataCache->lookupObjId($a_ref_id); } else { $ilCtrl->setParameter($this, 'userdetails_id', $a_sub_id); $obj_id = $ilObjDataCache->lookupObjId($a_sub_id); } $marks = new ilLPMarks($obj_id, $a_user_id); $tpl = new ilTemplate('tpl.lp_edit_user.html', true, true, 'Services/Tracking'); $tpl->setVariable("OBJ_TITLE", $lng->txt("edit") . ": " . $ilObjDataCache->lookupTitle($obj_id)); $tpl->setVariable("OBJ_SUBTITLE", $this->lng->txt('trac_mode') . ": " . ilLPObjSettings::_mode2Text(ilLPObjSettings::_lookupMode($obj_id))); $ilCtrl->setParameter($this, 'user_id', $a_user_id); $ilCtrl->setParameter($this, 'details_id', $a_ref_id); $tpl->setVariable("FORMACTION", $ilCtrl->getFormAction($this)); $tpl->setVariable("TYPE_IMG", ilObjUser::_getPersonalPicturePath($a_user_id, 'xxsmall')); $tpl->setVariable("ALT_IMG", $ilObjDataCache->lookupTitle($a_user_id)); $tpl->setVariable("TXT_LP", $lng->txt('trac_learning_progress_tbl_header')); $tpl->setVariable("COMMENT", ilUtil::prepareFormOutput($marks->getComment(), false)); $type = $ilObjDataCache->lookupType($obj_id); if ($type != 'lm') { $tpl->setVariable("TXT_MARK", $lng->txt('trac_mark')); $tpl->setVariable("MARK", ilUtil::prepareFormOutput($marks->getMark(), false)); } $tpl->setVariable("TXT_COMMENT", $lng->txt('trac_comment')); $mode = ilLPObjSettings::_lookupMode($obj_id); if ($mode == LP_MODE_MANUAL or $mode == LP_MODE_MANUAL_BY_TUTOR) { include_once "./Services/Tracking/classes/class.ilLPStatus.php"; $completed = ilLPStatus::_lookupStatus($obj_id, $a_user_id); $tpl->setVariable("mode_manual"); $tpl->setVariable("TXT_COMPLETED", $lng->txt('trac_completed')); $tpl->setVariable("CHECK_COMPLETED", ilUtil::formCheckbox($completed == LP_STATUS_COMPLETED_NUM, 'completed', '1')); } $tpl->setVariable("TXT_CANCEL", $lng->txt('cancel')); $tpl->setVariable("TXT_SAVE", $lng->txt('save')); $tpl->setVariable("CMD_CANCEL", $a_cancel); return $tpl->get(); }
/** * Init user form */ function initForm($a_mode) { global $lng, $ilCtrl, $styleDefinition, $ilSetting, $ilClientIniFile, $ilUser; $settings = $ilSetting->getAll(); include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form_gui = new ilPropertyFormGUI(); $this->form_gui->setFormAction($ilCtrl->getFormAction($this)); if ($a_mode == "create") { $this->form_gui->setTitle($lng->txt("usr_new")); } else { $this->form_gui->setTitle($lng->txt("usr_edit")); } // login data $sec_l = new ilFormSectionHeaderGUI(); $sec_l->setTitle($lng->txt("login_data")); $this->form_gui->addItem($sec_l); // authentication mode include_once './Services/Authentication/classes/class.ilAuthUtils.php'; $active_auth_modes = ilAuthUtils::_getActiveAuthModes(); $am = new ilSelectInputGUI($lng->txt("auth_mode"), "auth_mode"); $option = array(); foreach ($active_auth_modes as $auth_name => $auth_key) { if ($auth_name == 'default') { $name = $this->lng->txt('auth_' . $auth_name) . " (" . $this->lng->txt('auth_' . ilAuthUtils::_getAuthModeName($auth_key)) . ")"; } else { $name = $this->lng->txt('auth_' . $auth_name); } $option[$auth_name] = $name; } $am->setOptions($option); $this->form_gui->addItem($am); if ($a_mode == "edit") { $id = new ilNonEditableValueGUI($lng->txt("usr_id"), "id"); $id->setValue($this->object->getId()); $this->form_gui->addItem($id); } // login $lo = new ilUserLoginInputGUI($lng->txt("login"), "login"); $lo->setRequired(true); if ($a_mode == "edit") { $lo->setCurrentUserId($this->object->getId()); try { include_once 'Services/Calendar/classes/class.ilDate.php'; $last_history_entry = ilObjUser::_getLastHistoryDataByUserId($this->object->getId()); $lo->setInfo(sprintf($this->lng->txt('usr_loginname_history_info'), ilDatePresentation::formatDate(new ilDateTime($last_history_entry[1], IL_CAL_UNIX)), $last_history_entry[0])); } catch (ilUserException $e) { } } $this->form_gui->addItem($lo); $pw = new ilPasswordInputGUI($lng->txt("passwd"), "passwd"); $pw->setSize(32); $pw->setMaxLength(32); $pw->setValidateAuthPost("auth_mode"); if ($a_mode == "create") { $pw->setRequiredOnAuth(true); } $pw->setInfo(ilUtil::getPasswordRequirementsInfo()); $this->form_gui->addItem($pw); // @todo: invisible/hidden passwords // external account include_once './Services/Authentication/classes/class.ilAuthUtils.php'; if (ilAuthUtils::_isExternalAccountEnabled()) { $ext = new ilTextInputGUI($lng->txt("user_ext_account"), "ext_account"); $ext->setSize(40); $ext->setMaxLength(250); $ext->setInfo($lng->txt("user_ext_account_desc")); $this->form_gui->addItem($ext); } // login data $sec_si = new ilFormSectionHeaderGUI(); $sec_si->setTitle($this->lng->txt("system_information")); $this->form_gui->addItem($sec_si); // create date, approve date, agreement date, last login if ($a_mode == "edit") { $sia = array("create_date", "approve_date", "agree_date", "last_login", "owner"); foreach ($sia as $a) { $siai = new ilNonEditableValueGUI($lng->txt($a), $a); $this->form_gui->addItem($siai); } } // active $ac = new ilCheckboxInputGUI($lng->txt("active"), "active"); $ac->setChecked(true); $this->form_gui->addItem($ac); // access @todo: get fields right (names change) $lng->loadLanguageModule('crs'); // access $radg = new ilRadioGroupInputGUI($lng->txt("time_limit"), "time_limit_unlimited"); $radg->setValue(1); $op1 = new ilRadioOption($lng->txt("user_access_unlimited"), 1); $radg->addOption($op1); $op2 = new ilRadioOption($lng->txt("user_access_limited"), 0); $radg->addOption($op2); // $ac = new ilCheckboxInputGUI($lng->txt("time_limit"), "time_limit_unlimited"); // $ac->setChecked(true); // $ac->setOptionTitle($lng->txt("crs_unlimited")); // access.from $acfrom = new ilDateTimeInputGUI($this->lng->txt("crs_from"), "time_limit_from"); $acfrom->setShowTime(true); // $ac->addSubItem($acfrom); $op2->addSubItem($acfrom); // access.to $acto = new ilDateTimeInputGUI($this->lng->txt("crs_to"), "time_limit_until"); $acto->setShowTime(true); // $ac->addSubItem($acto); $op2->addSubItem($acto); // $this->form_gui->addItem($ac); $this->form_gui->addItem($radg); require_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php'; if (ilDiskQuotaActivationChecker::_isActive()) { $lng->loadLanguageModule("file"); $quota_head = new ilFormSectionHeaderGUI(); $quota_head->setTitle($lng->txt("repository_disk_quota")); $this->form_gui->addItem($quota_head); // disk quota $disk_quota = new ilTextInputGUI($lng->txt("disk_quota"), "disk_quota"); $disk_quota->setSize(10); $disk_quota->setMaxLength(11); $disk_quota->setInfo($this->lng->txt("enter_in_mb_desc")); $this->form_gui->addItem($disk_quota); if ($a_mode == "edit") { // show which disk quota is in effect, and explain why require_once 'Services/WebDAV/classes/class.ilDiskQuotaChecker.php'; $dq_info = ilDiskQuotaChecker::_lookupDiskQuota($this->object->getId()); if ($dq_info['user_disk_quota'] > $dq_info['role_disk_quota']) { $info_text = sprintf($lng->txt('disk_quota_is_1_instead_of_2_by_3'), ilFormat::formatSize($dq_info['user_disk_quota'], 'short'), ilFormat::formatSize($dq_info['role_disk_quota'], 'short'), $dq_info['role_title']); } else { if (is_infinite($dq_info['role_disk_quota'])) { $info_text = sprintf($lng->txt('disk_quota_is_unlimited_by_1'), $dq_info['role_title']); } else { $info_text = sprintf($lng->txt('disk_quota_is_1_by_2'), ilFormat::formatSize($dq_info['role_disk_quota'], 'short'), $dq_info['role_title']); } } $disk_quota->setInfo($this->lng->txt("enter_in_mb_desc") . '<br>' . $info_text); // disk usage $du_info = ilDiskQuotaChecker::_lookupDiskUsage($this->object->getId()); $disk_usage = new ilNonEditableValueGUI($lng->txt("disk_usage"), "disk_usage"); if ($du_info['last_update'] === null) { $disk_usage->setValue($lng->txt('unknown')); } else { require_once './Services/Utilities/classes/class.ilFormat.php'; $disk_usage->setValue(ilFormat::formatSize($du_info['disk_usage'], 'short')); $info = '<table class="il_user_quota_disk_usage_overview">'; // write the count and size of each object type foreach ($du_info['details'] as $detail_data) { $info .= '<tr>' . '<td class="std">' . $detail_data['count'] . '</td>' . '<td class="std">' . $lng->txt($detail_data['type']) . '</td>' . '<td class="std">' . ilFormat::formatSize($detail_data['size'], 'short') . '</td>' . '</tr>'; } $info .= '</table>'; $info .= '<br>' . $this->lng->txt('last_update') . ': ' . ilDatePresentation::formatDate(new ilDateTime($du_info['last_update'], IL_CAL_DATETIME)); $disk_usage->setInfo($info); } $this->form_gui->addItem($disk_usage); // date when the last disk quota reminder was sent to the user if (true || $dq_info['last_reminder']) { $reminder = new ilNonEditableValueGUI($lng->txt("disk_quota_last_reminder_sent"), "last_reminder"); $reminder->setValue(ilDatePresentation::formatDate(new ilDateTime($dq_info['last_reminder'], IL_CAL_DATETIME))); $reminder->setInfo($this->lng->txt("disk_quota_last_reminder_sent_desc")); $this->form_gui->addItem($reminder); } } } if (ilDiskQuotaActivationChecker::_isPersonalWorkspaceActive()) { $lng->loadLanguageModule("file"); $quota_head = new ilFormSectionHeaderGUI(); $quota_head->setTitle($lng->txt("personal_workspace_disk_quota")); $this->form_gui->addItem($quota_head); // personal workspace disk quota $wsp_disk_quota = new ilTextInputGUI($lng->txt("disk_quota"), "wsp_disk_quota"); $wsp_disk_quota->setSize(10); $wsp_disk_quota->setMaxLength(11); $wsp_disk_quota->setInfo($this->lng->txt("enter_in_mb_desc")); $this->form_gui->addItem($wsp_disk_quota); if ($a_mode == "edit") { // show which disk quota is in effect, and explain why require_once 'Services/WebDAV/classes/class.ilDiskQuotaChecker.php'; $dq_info = ilDiskQuotaChecker::_lookupPersonalWorkspaceDiskQuota($this->object->getId()); if ($dq_info['user_wsp_disk_quota'] > $dq_info['role_wsp_disk_quota']) { $info_text = sprintf($lng->txt('disk_quota_is_1_instead_of_2_by_3'), ilFormat::formatSize($dq_info['user_wsp_disk_quota'], 'short'), ilFormat::formatSize($dq_info['role_wsp_disk_quota'], 'short'), $dq_info['role_title']); } else { if (is_infinite($dq_info['role_wsp_disk_quota'])) { $info_text = sprintf($lng->txt('disk_quota_is_unlimited_by_1'), $dq_info['role_title']); } else { $info_text = sprintf($lng->txt('disk_quota_is_1_by_2'), ilFormat::formatSize($dq_info['role_wsp_disk_quota'], 'short'), $dq_info['role_title']); } } $wsp_disk_quota->setInfo($this->lng->txt("enter_in_mb_desc") . '<br>' . $info_text); } // disk usage include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php"; $du_info = ilDiskQuotaHandler::getFilesizeByTypeAndOwner($this->object->getId()); $disk_usage = new ilNonEditableValueGUI($lng->txt("disk_usage"), "disk_usage"); if (!sizeof($du_info)) { $disk_usage->setValue($lng->txt('unknown')); } else { require_once './Services/Utilities/classes/class.ilFormat.php'; $disk_usage->setValue(ilFormat::formatSize(ilDiskQuotaHandler::getFilesizeByOwner($this->object->getId()))); $info = '<table class="il_user_quota_disk_usage_overview">'; // write the count and size of each object type foreach ($du_info as $detail_data) { $info .= '<tr>' . '<td class="std">' . $detail_data['count'] . '</td>' . '<td class="std">' . $lng->txt("obj_" . $detail_data["src_type"]) . '</td>' . '<td class="std">' . ilFormat::formatSize($detail_data['filesize'], 'short') . '</td>' . '</tr>'; } $info .= '</table>'; $disk_usage->setInfo($info); } $this->form_gui->addItem($disk_usage); } // personal data if ($this->isSettingChangeable('gender') or $this->isSettingChangeable('firstname') or $this->isSettingChangeable('lastname') or $this->isSettingChangeable('title') or $this->isSettingChangeable('personal_image') or $this->isSettingChangeable('birhtday')) { $sec_pd = new ilFormSectionHeaderGUI(); $sec_pd->setTitle($this->lng->txt("personal_data")); $this->form_gui->addItem($sec_pd); } // gender if ($this->isSettingChangeable('gender')) { $gndr = new ilRadioGroupInputGUI($lng->txt("gender"), "gender"); $gndr->setRequired(isset($settings["require_gender"]) && $settings["require_gender"]); $female = new ilRadioOption($lng->txt("gender_f"), "f"); $gndr->addOption($female); $male = new ilRadioOption($lng->txt("gender_m"), "m"); $gndr->addOption($male); $this->form_gui->addItem($gndr); } // firstname, lastname, title $fields = array("firstname" => true, "lastname" => true, "title" => isset($settings["require_title"]) && $settings["require_title"]); foreach ($fields as $field => $req) { if ($this->isSettingChangeable($field)) { $inp = new ilTextInputGUI($lng->txt($field), $field); $inp->setSize(32); $inp->setMaxLength(32); $inp->setRequired($req); $this->form_gui->addItem($inp); } } // personal image if ($this->isSettingChangeable('upload')) { $pi = new ilImageFileInputGUI($lng->txt("personal_picture"), "userfile"); if ($a_mode == "edit" || $a_mode == "upload") { $pi->setImage(ilObjUser::_getPersonalPicturePath($this->object->getId(), "small", true, true)); } $this->form_gui->addItem($pi); } if ($this->isSettingChangeable('birthday')) { $birthday = new ilBirthdayInputGUI($lng->txt('birthday'), 'birthday'); $birthday->setRequired(isset($settings["require_birthday"]) && $settings["require_birthday"]); $birthday->setShowEmpty(true); $birthday->setStartYear(1900); $this->form_gui->addItem($birthday); } // institution, department, street, city, zip code, country, phone office // phone home, phone mobile, fax, e-mail $fields = array(array("institution", 40, 80), array("department", 40, 80), array("street", 40, 40), array("city", 40, 40), array("zipcode", 10, 10), array("country", 40, 40), array("sel_country"), array("phone_office", 30, 30), array("phone_home", 30, 30), array("phone_mobile", 30, 30), array("fax", 30, 30)); $counter = 0; foreach ($fields as $field) { if (!$counter++ and $this->isSettingChangeable($field[0])) { // contact data $sec_cd = new ilFormSectionHeaderGUI(); $sec_cd->setTitle($this->lng->txt("contact_data")); $this->form_gui->addItem($sec_cd); } if ($this->isSettingChangeable($field[0])) { if ($field[0] != "sel_country") { $inp = new ilTextInputGUI($lng->txt($field[0]), $field[0]); $inp->setSize($field[1]); $inp->setMaxLength($field[2]); $inp->setRequired(isset($settings["require_" . $field[0]]) && $settings["require_" . $field[0]]); $this->form_gui->addItem($inp); } else { // country selection include_once "./Services/Form/classes/class.ilCountrySelectInputGUI.php"; $cs = new ilCountrySelectInputGUI($lng->txt($field[0]), $field[0]); $cs->setRequired(isset($settings["require_" . $field[0]]) && $settings["require_" . $field[0]]); $this->form_gui->addItem($cs); } } } // email if ($this->isSettingChangeable('email')) { $em = new ilEMailInputGUI($lng->txt("email"), "email"); $em->setRequired(isset($settings["require_email"]) && $settings["require_email"]); $this->form_gui->addItem($em); } // interests/hobbies if ($this->isSettingChangeable('hobby')) { $hob = new ilTextAreaInputGUI($lng->txt("hobby"), "hobby"); $hob->setRows(3); $hob->setCols(40); $hob->setRequired(isset($settings["require_hobby"]) && $settings["require_hobby"]); $this->form_gui->addItem($hob); } // referral comment if ($this->isSettingChangeable('referral_comment')) { $rc = new ilTextAreaInputGUI($lng->txt("referral_comment"), "referral_comment"); $rc->setRows(3); $rc->setCols(40); $rc->setRequired(isset($settings["require_referral_comment"]) && $settings["require_referral_comment"]); $this->form_gui->addItem($rc); } // interests $sh = new ilFormSectionHeaderGUI(); $sh->setTitle($lng->txt("interests")); $this->form_gui->addItem($sh); $multi_fields = array("interests_general", "interests_help_offered", "interests_help_looking"); foreach ($multi_fields as $multi_field) { if ($this->isSettingChangeable($multi_field)) { // see ilUserProfile $ti = new ilTextInputGUI($lng->txt($multi_field), $multi_field); $ti->setMulti(true); $ti->setMaxLength(40); $ti->setSize(40); $ti->setRequired(isset($settings["require_" . $multi_field]) && $settings["require_" . $multi_field]); $this->form_gui->addItem($ti); } } // instant messengers if ($this->isSettingChangeable('instant_messengers')) { $sec_im = new ilFormSectionHeaderGUI(); $sec_im->setTitle($this->lng->txt("instant_messengers")); $this->form_gui->addItem($sec_im); } // icq, yahoo, msn, aim, skype $fields = array("icq", "yahoo", "msn", "aim", "skype", "jabber", "voip"); foreach ($fields as $field) { if ($this->isSettingChangeable('instant_messengers')) { $im = new ilTextInputGUI($lng->txt("im_" . $field), "im_" . $field); $im->setSize(40); $im->setMaxLength(40); $this->form_gui->addItem($im); } } // other information if ($this->isSettingChangeable('user_profile_other')) { $sec_oi = new ilFormSectionHeaderGUI(); $sec_oi->setTitle($this->lng->txt("user_profile_other")); $this->form_gui->addItem($sec_oi); } // matriculation number if ($this->isSettingChangeable('matriculation')) { $mr = new ilTextInputGUI($lng->txt("matriculation"), "matriculation"); $mr->setSize(40); $mr->setMaxLength(40); $mr->setRequired(isset($settings["require_matriculation"]) && $settings["require_matriculation"]); $this->form_gui->addItem($mr); } // delicious if ($this->isSettingChangeable('delicious')) { $mr = new ilTextInputGUI($lng->txt("delicious"), "delicious"); $mr->setSize(40); $mr->setMaxLength(40); $mr->setRequired(isset($settings["require_delicious"]) && $settings["require_delicious"]); $this->form_gui->addItem($mr); } // client IP $ip = new ilTextInputGUI($lng->txt("client_ip"), "client_ip"); $ip->setSize(40); $ip->setMaxLength(255); $ip->setInfo($this->lng->txt("current_ip") . " " . $_SERVER["REMOTE_ADDR"] . " <br />" . '<span class="warning">' . $this->lng->txt("current_ip_alert") . "</span>"); $this->form_gui->addItem($ip); // additional user defined fields include_once './Services/User/classes/class.ilUserDefinedFields.php'; $user_defined_fields = ilUserDefinedFields::_getInstance(); if ($this->usrf_ref_id == USER_FOLDER_ID) { $all_defs = $user_defined_fields->getDefinitions(); } else { $all_defs = $user_defined_fields->getChangeableLocalUserAdministrationDefinitions(); } foreach ($all_defs as $field_id => $definition) { if ($definition['field_type'] == UDF_TYPE_TEXT) { $udf = new ilTextInputGUI($definition['field_name'], "udf_" . $definition['field_id']); $udf->setSize(40); $udf->setMaxLength(255); } else { if ($definition['field_type'] == UDF_TYPE_WYSIWYG) { $udf = new ilTextAreaInputGUI($definition['field_name'], "udf_" . $definition['field_id']); $udf->setUseRte(true); } else { $udf = new ilSelectInputGUI($definition['field_name'], "udf_" . $definition['field_id']); $udf->setOptions($user_defined_fields->fieldValuesToSelectArray($definition['field_values'])); } } $udf->setRequired($definition['required']); $this->form_gui->addItem($udf); } // settings if ($a_mode == 'create' or $this->isSettingChangeable('language') or $this->isSettingChangeable('skin_style') or $this->isSettingChangeable('hits_per_page') or $this->isSettingChangeable('hide_own_online_status')) { $sec_st = new ilFormSectionHeaderGUI(); $sec_st->setTitle($this->lng->txt("settings")); $this->form_gui->addItem($sec_st); } // role if ($a_mode == "create") { $role = new ilSelectInputGUI($lng->txt("default_role"), 'default_role'); $role->setRequired(true); $role->setValue($this->default_role); $role->setOptions($this->selectable_roles); $this->form_gui->addItem($role); } // language if ($this->isSettingChangeable('language')) { $lang = new ilSelectInputGUI($lng->txt("language"), 'language'); $languages = $lng->getInstalledLanguages(); $lng->loadLanguageModule("meta"); $options = array(); foreach ($languages as $l) { $options[$l] = $lng->txt("meta_l_" . $l); } $lang->setOptions($options); $lang->setValue($ilSetting->get("language")); $this->form_gui->addItem($lang); } // skin/style if ($this->isSettingChangeable('skin_style')) { $sk = new ilSelectInputGUI($lng->txt("skin_style"), 'skin_style'); $templates = $styleDefinition->getAllTemplates(); include_once "./Services/Style/classes/class.ilObjStyleSettings.php"; $options = array(); if (count($templates) > 0 && is_array($templates)) { foreach ($templates as $template) { $styleDef =& new ilStyleDefinition($template["id"]); $styleDef->startParsing(); $styles = $styleDef->getStyles(); foreach ($styles as $style) { if (!ilObjStyleSettings::_lookupActivatedStyle($template["id"], $style["id"])) { continue; } $options[$template["id"] . ":" . $style["id"]] = $styleDef->getTemplateName() . " / " . $style["name"]; } } } $sk->setOptions($options); $sk->setValue($ilClientIniFile->readVariable("layout", "skin") . ":" . $ilClientIniFile->readVariable("layout", "style")); $this->form_gui->addItem($sk); } // hits per page if ($this->isSettingChangeable('hits_per_page')) { $hpp = new ilSelectInputGUI($lng->txt("hits_per_page"), 'hits_per_page'); $options = array(10 => 10, 15 => 15, 20 => 20, 30 => 30, 40 => 40, 50 => 50, 100 => 100, 9999 => $this->lng->txt("no_limit")); $hpp->setOptions($options); $hpp->setValue($ilSetting->get("hits_per_page")); $this->form_gui->addItem($hpp); // users online $uo = new ilSelectInputGUI($lng->txt("users_online"), 'show_users_online'); $options = array("y" => $lng->txt("users_online_show_y"), "associated" => $lng->txt("users_online_show_associated"), "n" => $lng->txt("users_online_show_n")); $uo->setOptions($options); $uo->setValue($ilSetting->get("show_users_online")); $this->form_gui->addItem($uo); } // hide online status if ($this->isSettingChangeable('hide_own_online_status')) { $os = new ilCheckboxInputGUI($lng->txt("hide_own_online_status"), "hide_own_online_status"); $this->form_gui->addItem($os); } if ((int) $ilSetting->get('session_reminder_enabled')) { $cb = new ilCheckboxInputGUI($this->lng->txt('session_reminder'), 'session_reminder_enabled'); $cb->setValue(1); $this->form_gui->addItem($cb); } // Options if ($this->isSettingChangeable('send_mail')) { $sec_op = new ilFormSectionHeaderGUI(); $sec_op->setTitle($this->lng->txt("options")); $this->form_gui->addItem($sec_op); } // send email $se = new ilCheckboxInputGUI($lng->txt('inform_user_mail'), 'send_mail'); $se->setInfo($lng->txt('inform_user_mail_info')); $se->setValue('y'); $se->setChecked($ilUser->getPref('send_info_mails') == 'y'); $this->form_gui->addItem($se); // ignore required fields $irf = new ilCheckboxInputGUI($lng->txt('ignore_required_fields'), 'ignore_rf'); $irf->setInfo($lng->txt('ignore_required_fields_info')); $irf->setValue(1); $this->form_gui->addItem($irf); // @todo: handle all required fields // command buttons if ($a_mode == "create" || $a_mode == "save") { $this->form_gui->addCommandButton("save", $lng->txt("save")); } if ($a_mode == "edit" || $a_mode == "update") { $this->form_gui->addCommandButton("update", $lng->txt("save")); } $this->form_gui->addCommandButton("cancel", $lng->txt("cancel")); }
/** * get notes/comments list as html code */ function getNoteListHTML($a_type = IL_NOTE_PRIVATE, $a_init_form = true) { global $lng, $ilCtrl, $ilUser; include_once "./Services/User/classes/class.ilUserUtil.php"; $suffix = $a_type == IL_NOTE_PRIVATE ? "private" : "public"; /* user settings are deprecated $user_setting_notes_public_all = $ilUser->getPref("notes_pub_all"); $user_setting_notes_by_type = $ilUser->getPref("notes_".$suffix); */ $user_setting_notes_public_all = "y"; $user_setting_notes_by_type = "y"; if ($this->delete_note || $this->export_html || $this->print) { if ($_GET["note_id"] != "") { $filter = $_GET["note_id"]; } else { $filter = $_POST["note"]; } } $notes = ilNote::_getNotesOfObject($this->rep_obj_id, $this->obj_id, $this->obj_type, $a_type, $this->inc_sub, $filter, $user_setting_notes_public_all, $this->repository_mode, (bool) $_SESSION["comments_sort_asc"]); $all_notes = ilNote::_getNotesOfObject($this->rep_obj_id, $this->obj_id, $this->obj_type, $a_type, $this->inc_sub, $filter, "", $this->repository_mode); $tpl = new ilTemplate("tpl.notes_list.html", true, true, "Services/Notes"); if ($this->ajax) { include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php"; $tpl->setCurrentBlock("close_img"); $tpl->setVariable("CLOSE_IMG", ilGlyphGUI::get(ilGlyphGUI::CLOSE)); $tpl->parseCurrentBlock(); } // show counter if notes are hidden $cnt_str = count($all_notes) > 0 ? " (" . count($all_notes) . ")" : ""; // title if ($this->ajax) { switch ($this->obj_type) { case "catr": case "crsr": include_once "Services/ContainerReference/classes/class.ilContainerReference.php"; $title = ilContainerReference::_lookupTitle($this->rep_obj_id); break; default: $title = ilObject::_lookupTitle($this->rep_obj_id); break; } $img = ilUtil::img(ilObject::_getIcon($this->rep_obj_id, "tiny")); // add sub-object if given if ($this->obj_id) { $sub_title = $this->getSubObjectTitle($this->rep_obj_id, $this->obj_id); if ($sub_title) { $title .= " - " . $sub_title; } } $tpl->setCurrentBlock("title"); $tpl->setVariable("TITLE", $img . " " . $title); $tpl->parseCurrentBlock(); } if ($this->delete_note) { $cnt_str = ""; } if ($a_type == IL_NOTE_PRIVATE) { $tpl->setVariable("TXT_NOTES", $lng->txt("private_notes") . $cnt_str); $ilCtrl->setParameterByClass("ilnotegui", "note_type", IL_NOTE_PRIVATE); } else { $tpl->setVariable("TXT_NOTES", $lng->txt("notes_public_comments") . $cnt_str); $ilCtrl->setParameterByClass("ilnotegui", "note_type", IL_NOTE_PUBLIC); } $anch = $this->anchor_jump ? "notes_top" : ""; $tpl->setVariable("FORMACTION", $ilCtrl->getFormAction($this, "getNotesHTML", $anch)); if ($this->ajax) { $os = "onsubmit = \"ilNotes.cmdAjaxForm(event, '" . $ilCtrl->getFormActionByClass("ilnotegui", "", "", true) . "'); return false;\""; $tpl->setVariable("ON_SUBMIT_FORM", $os); $tpl->setVariable("FORM_ID", "Ajax"); } if ($this->export_html || $this->print) { $tpl->touchBlock("print_style"); } // show add new note button if (!$this->add_note_form && !$this->edit_note_form && !$this->delete_note && !$this->export_html && !$this->print && $ilUser->getId() != ANONYMOUS_USER_ID) { if (!$this->inc_sub) { // are displayed if ($this->rep_obj_id > 0 || $a_type != IL_NOTE_PUBLIC) { $tpl->setCurrentBlock("add_note_btn"); if ($a_type == IL_NOTE_PUBLIC) { $tpl->setVariable("TXT_ADD_NOTE", $lng->txt("notes_add_comment")); } else { $tpl->setVariable("TXT_ADD_NOTE", $lng->txt("add_note")); } $tpl->setVariable("LINK_ADD_NOTE", $ilCtrl->getLinkTargetByClass("ilnotegui", "addNoteForm") . "#note_edit"); $tpl->parseCurrentBlock(); } } } // show show/hide button for note list if (count($all_notes) > 0 && $this->enable_hiding && !$this->delete_note && !$this->export_html && !$this->print && !$this->edit_note_form && !$this->add_note_form) { if ($user_setting_notes_by_type == "n") { if ($a_type == IL_NOTE_PUBLIC) { $txt = $lng->txt("notes_show_comments"); } else { $txt = $lng->txt("show_" . $suffix . "_notes"); } $this->renderLink($tpl, "show_notes", $txt, "showNotes", "notes_top"); } else { // never individually hide for anonymous users if ($ilUser->getId() != ANONYMOUS_USER_ID) { if ($a_type == IL_NOTE_PUBLIC) { $txt = $lng->txt("notes_hide_comments"); } else { $txt = $lng->txt("hide_" . $suffix . "_notes"); } $this->renderLink($tpl, "hide_notes", $txt, "hideNotes", "notes_top"); // show all public notes / my notes only switch if ($a_type == IL_NOTE_PUBLIC) { if ($user_setting_notes_public_all == "n") { $this->renderLink($tpl, "all_pub_notes", $lng->txt("notes_all_comments"), "showAllPublicNotes", "notes_top"); } else { $this->renderLink($tpl, "my_pub_notes", $lng->txt("notes_my_comments"), "showMyPublicNotes", "notes_top"); } } } } } // show add new note text area if (!$this->edit_note_form && $user_setting_notes_by_type != "n" && !$this->delete_note && $ilUser->getId() != ANONYMOUS_USER_ID) { if ($a_init_form) { $this->initNoteForm("create", $a_type); } $tpl->setCurrentBlock("edit_note_form"); // $tpl->setVariable("EDIT_FORM", $this->form->getHTML()); $tpl->setVariable("EDIT_FORM", $this->form_tpl->get()); $tpl->parseCurrentBlock(); $tpl->parseCurrentBlock(); $tpl->setCurrentBlock("note_row"); $tpl->parseCurrentBlock(); } // list all notes if ($user_setting_notes_by_type != "n" || !$this->enable_hiding) { $reldates = ilDatePresentation::useRelativeDates(); ilDatePresentation::setUseRelativeDates(false); if (sizeof($notes)) { if ((int) $_SESSION["comments_sort_asc"] == 1) { $sort_txt = $lng->txt("notes_sort_desc"); $sort_cmd = "listSortDesc"; } else { $sort_txt = $lng->txt("notes_sort_asc"); $sort_cmd = "listSortAsc"; } $this->renderLink($tpl, "sort_list", $sort_txt, $sort_cmd, $anch); } $notes_given = false; foreach ($notes as $note) { if ($this->edit_note_form && $note->getId() == $_GET["note_id"] && $a_type == $_GET["note_type"]) { if ($a_init_form) { $this->initNoteForm("edit", $a_type, $note); } $tpl->setCurrentBlock("edit_note_form"); // $tpl->setVariable("EDIT_FORM", $this->form->getHTML()); $tpl->setVariable("EDIT_FORM", $this->form_tpl->get()); $tpl->parseCurrentBlock(); } else { $cnt_col = 2; // delete note stuff for all private notes if ($this->checkDeletion($note) && !$this->delete_note && !$this->export_html && !$this->print && !$this->edit_note_form && !$this->add_note_form) { $ilCtrl->setParameterByClass("ilnotegui", "note_id", $note->getId()); $this->renderLink($tpl, "delete_note", $lng->txt("delete"), "deleteNote", "note_" . $note->getId()); } // checkboxes in multiselection mode if ($this->multi_selection && !$this->delete_note) { $tpl->setCurrentBlock("checkbox_col"); $tpl->setVariable("CHK_NOTE", "note[]"); $tpl->setVariable("CHK_NOTE_ID", $note->getId()); $tpl->parseCurrentBlock(); $cnt_col = 1; } // edit note stuff for all private notes if ($this->checkEdit($note)) { if (!$this->delete_note && !$this->export_html && !$this->print && !$this->edit_note_form && !$this->add_note_form) { $ilCtrl->setParameterByClass("ilnotegui", "note_id", $note->getId()); $this->renderLink($tpl, "edit_note", $lng->txt("edit"), "editNoteForm", "note_edit"); } } $tpl->setVariable("CNT_COL", $cnt_col); // output author account if ($a_type == IL_NOTE_PUBLIC && ilObject::_exists($note->getAuthor())) { //$tpl->setCurrentBlock("author"); //$tpl->setVariable("VAL_AUTHOR", ilObjUser::_lookupLogin($note->getAuthor())); //$tpl->parseCurrentBlock(); $tpl->setCurrentBlock("user_img"); $tpl->setVariable("USR_IMG", ilObjUser::_getPersonalPicturePath($note->getAuthor(), "xxsmall")); $tpl->setVariable("USR_ALT", $lng->txt("user_image") . ": " . ilObjUser::_lookupLogin($note->getAuthor())); $tpl->parseCurrentBlock(); $tpl->setVariable("TXT_USR", ilUserUtil::getNamePresentation($note->getAuthor(), false, false) . " - "); } // last edited if ($note->getUpdateDate() != null) { $tpl->setVariable("TXT_LAST_EDIT", $lng->txt("last_edited_on")); $tpl->setVariable("DATE_LAST_EDIT", ilDatePresentation::formatDate(new ilDate($note->getUpdateDate(), IL_CAL_DATETIME))); } else { $tpl->setVariable("VAL_DATE", ilDatePresentation::formatDate(new ilDate($note->getCreationDate(), IL_CAL_DATETIME))); } // hidden note ids for deletion if ($this->delete_note) { $tpl->setCurrentBlock("delete_ids"); $tpl->setVariable("HID_NOTE", "note[]"); $tpl->setVariable("HID_NOTE_ID", $note->getId()); $tpl->parseCurrentBlock(); } $target = $note->getObject(); // target objects $this->showTargets($tpl, $this->rep_obj_id, $note->getId(), $target["obj_type"], $target["obj_id"]); $rowclass = $rowclass != "tblrow1" ? "tblrow1" : "tblrow2"; if (!$this->export_html && !$this->print) { $tpl->setCurrentBlock("note_img"); if ($a_type == IL_NOTE_PUBLIC) { $tpl->setVariable("IMG_NOTE", $this->comment_img[$note->getLabel()]["img"]); $tpl->setVariable("ALT_NOTE", $this->comment_img[$note->getLabel()]["alt"]); } else { $tpl->setVariable("IMG_NOTE", $this->note_img[$note->getLabel()]["img"]); $tpl->setVariable("ALT_NOTE", $this->note_img[$note->getLabel()]["alt"]); } $tpl->parseCurrentBlock(); } else { switch ($note->getLabel()) { case IL_NOTE_UNLABELED: $tpl->setVariable("EXP_ICON", "[ ]"); break; case IL_NOTE_IMPORTANT: $tpl->setVariable("EXP_ICON", "[!]"); break; case IL_NOTE_QUESTION: $tpl->setVariable("EXP_ICON", "[?]"); break; case IL_NOTE_PRO: $tpl->setVariable("EXP_ICON", "[+]"); break; case IL_NOTE_CONTRA: $tpl->setVariable("EXP_ICON", "[-]"); break; } } $tpl->setCurrentBlock("note"); $tpl->setVariable("ROWCLASS", $rowclass); $text = trim($note->getText()) != "" ? nl2br($note->getText()) : "<p class='subtitle'>" . $lng->txt("note_content_removed") . "</p>"; $tpl->setVariable("NOTE_TEXT", $text); $tpl->setVariable("VAL_SUBJECT", $note->getSubject()); $tpl->setVariable("NOTE_ID", $note->getId()); $tpl->setVariable("CLASS", $a_type == IL_NOTE_PUBLIC ? "ilComment" : "ilNote"); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock("note_row"); $tpl->parseCurrentBlock(); $notes_given = true; } if (!$notes_given) { $tpl->setCurrentBlock("no_notes"); if ($a_type == IL_NOTE_PUBLIC) { $tpl->setVariable("NO_NOTES", $lng->txt("notes_no_comments")); } /* else { $tpl->setVariable("NO_NOTES", $lng->txt("notes_no_notes")); }*/ $tpl->parseCurrentBlock(); } ilDatePresentation::setUseRelativeDates($reldates); // multiple items commands if ($this->multi_selection && !$this->delete_note && !$this->edit_note_form && count($notes) > 0) { if ($a_type == IL_NOTE_PRIVATE) { $tpl->setCurrentBlock("delete_cmd"); $tpl->setVariable("TXT_DELETE_NOTES", $this->lng->txt("delete")); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock("multiple_commands"); $tpl->setVariable("TXT_SELECT_ALL", $this->lng->txt("select_all")); $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg")); $tpl->setVariable("ALT_ARROW", $this->lng->txt("actions")); $tpl->setVariable("TXT_PRINT_NOTES", $this->lng->txt("print")); $tpl->setVariable("TXT_EXPORT_NOTES", $this->lng->txt("exp_html")); $tpl->parseCurrentBlock(); } // delete / cancel row if ($this->delete_note) { $tpl->setCurrentBlock("delete_cancel"); $tpl->setVariable("TXT_DEL_NOTES", $this->lng->txt("delete")); $tpl->setVariable("TXT_CANCEL_DEL_NOTES", $this->lng->txt("cancel")); $tpl->parseCurrentBlock(); } // print if ($this->print) { $tpl->touchBlock("print_js"); $tpl->setCurrentBlock("print_back"); $tpl->setVariable("LINK_BACK", $this->ctrl->getLinkTarget($this, "showNotes")); $tpl->setVariable("TXT_BACK", $this->lng->txt("back")); $tpl->parseCurrentBlock(); } } // message switch ($_GET["note_mess"] != "" ? $_GET["note_mess"] : $this->note_mess) { case "mod": $mtype = "success"; $mtxt = $lng->txt("msg_obj_modified"); break; case "ntsdel": $mtype = "success"; $mtxt = $a_type == IL_NOTE_PRIVATE ? $lng->txt("notes_notes_deleted") : $lng->txt("notes_comments_deleted"); break; case "ntdel": $mtype = "success"; $mtxt = $a_type == IL_NOTE_PRIVATE ? $lng->txt("notes_note_deleted") : $lng->txt("notes_comment_deleted"); break; case "frmfld": $mtype = "failure"; $mtxt = $lng->txt("form_input_not_valid"); break; case "qdel": $mtype = "question"; $mtxt = $lng->txt("info_delete_sure"); break; case "noc": $mtype = "failure"; $mtxt = $lng->txt("no_checkbox"); break; } if ($mtxt != "") { $tpl->setVariable("MESS", $tpl->getMessageHTML($mtxt, $mtype)); } else { $tpl->setVariable("MESS", ""); } if ($this->delete_note && count($notes) == 0) { return ""; } else { return $tpl->get(); } }
/** * Build export file * * @param * @return */ function buildExportFile() { global $ilias; // create export file include_once "./Services/Export/classes/class.ilExport.php"; ilExport::_createExportDirectory($this->object->getId(), "html", "prtf"); $exp_dir = ilExport::_getExportDirectory($this->object->getId(), "html", "prtf"); $this->subdir = $this->object->getType() . "_" . $this->object->getId(); $this->export_dir = $exp_dir . "/" . $this->subdir; // initialize temporary target directory ilUtil::delDir($this->export_dir); ilUtil::makeDir($this->export_dir); // system style html exporter include_once "./Services/Style/classes/class.ilSystemStyleHTMLExport.php"; $this->sys_style_html_export = new ilSystemStyleHTMLExport($this->export_dir); // $this->sys_style_html_export->addImage("icon_prtf.svg"); $this->sys_style_html_export->export(); // init co page html exporter include_once "./Services/COPage/classes/class.ilCOPageHTMLExport.php"; $this->co_page_html_export = new ilCOPageHTMLExport($this->export_dir); $this->co_page_html_export->setContentStyleId($this->object->getStyleSheetId()); $this->co_page_html_export->createDirectories(); $this->co_page_html_export->exportStyles(); $this->co_page_html_export->exportSupportScripts(); // banner $prfa_set = new ilSetting("prfa"); if ($prfa_set->get("banner")) { $banner = $this->object->getImageFullPath(); if ($banner) { copy($banner, $this->export_dir . "/" . basename($banner)); } } // page element: profile picture $ppic = ilObjUser::_getPersonalPicturePath($this->object->getOwner(), "big", true, true); if ($ppic) { $ppic = array_shift(explode("?", $ppic)); copy($ppic, $this->export_dir . "/" . basename($ppic)); } // header image: profile picture $ppic = ilObjUser::_getPersonalPicturePath($this->object->getOwner(), "xsmall", true, true); if ($ppic) { $ppic = array_shift(explode("?", $ppic)); copy($ppic, $this->export_dir . "/" . basename($ppic)); } // export pages $this->exportHTMLPages(); // add js/images/file to zip $images = $files = $js_files = array(); foreach ($this->export_material as $items) { $images = array_merge($images, $items["images"]); $files = array_merge($files, $items["files"]); $js_files = array_merge($js_files, $items["js"]); } foreach (array_unique($images) as $image) { if (is_file($image)) { copy($image, $this->export_dir . "/images/" . basename($image)); } } foreach (array_unique($js_files) as $js_file) { if (is_file($js_file)) { copy($js_file, $this->export_dir . "/js/" . basename($js_file)); } } foreach (array_unique($files) as $file) { if (is_file($file)) { copy($file, $this->export_dir . "/files/" . basename($file)); } } // zip everything if (true) { // zip it all $date = time(); $zip_file = ilExport::_getExportDirectory($this->object->getId(), "html", "prtf") . "/" . $date . "__" . IL_INST_ID . "__" . $this->object->getType() . "_" . $this->object->getId() . ".zip"; ilUtil::zip($this->export_dir, $zip_file); ilUtil::delDir($this->export_dir); } return $zip_file; }
/** * get flat bookmark list for personal desktop */ function fillRow($a_set) { global $ilUser, $ilCtrl, $lng, $ilSetting, $rbacsetting, $rbacsystem; // mail link $a_set["mail_to"] = ""; if ($this->mail_allowed && $rbacsystem->checkAccessOfUser($a_set['id'], 'internal_mail', ilMailGlobalServices::getMailObjectRefId())) { $a_set['mail_url'] = ilMailFormCall::getLinkTarget($this->topGuiObj, '', array(), array('type' => 'new', 'rcp_to' => urlencode($a_set['login']))); } // check for profile $a_set["profile"] = in_array(ilObjUser::_lookupPref($a_set["id"], "public_profile"), array("y", "g")); // user image if ($this->getCurrentDetailLevel() > 2) { if ($a_set["mail_url"] != "") { $this->tpl->setCurrentBlock("mailto_link"); $this->tpl->setVariable("TXT_MAIL", $lng->txt("mail")); $this->tpl->setVariable("MAIL_URL", $a_set["mail_url"]); $this->tpl->parseCurrentBlock(); } $chatSettings = new ilSetting('chatroom'); if ($chatSettings->get('chat_enabled')) { if (!$this->__showActiveChatsOfUser($a_set["id"])) { // Show invite to chat $this->__showChatInvitation($a_set["id"]); } global $rbacsystem; include_once './Modules/Chatroom/classes/class.ilObjChatroom.php'; if ($a_set["id"] == $ilUser->getId() && $rbacsystem->checkAccess('read', ilObjChatroom::_getPublicRefId())) { $this->tpl->setCurrentBlock('chat_link'); $this->tpl->setVariable('TXT_CHAT_INVITE', $lng->txt('chat_enter_public_room')); $this->tpl->setVariable('TXT_CHAT_INVITE_TOOLTIP', $lng->txt('chat_enter_public_room_tooltip')); // $this->tpl->setVariable('CHAT_LINK','./ilias.php?baseClass=ilChatPresentationGUI&ref_id='.ilObjChat::_getPublicChatRefId()); $this->tpl->setVariable('CHAT_LINK', './ilias.php?baseClass=ilRepositoryGUI&cmd=view&ref_id=' . ilObjChatroom::_getPublicRefId()); $this->tpl->parseCurrentBlock(); } } // user image $this->tpl->setCurrentBlock("usr_image"); $this->tpl->setVariable("USR_IMAGE", ilObjUser::_getPersonalPicturePath($a_set["id"], "xxsmall")); $this->tpl->setVariable("USR_ALT", $lng->txt("personal_picture")); $this->tpl->parseCurrentBlock(); $this->tpl->touchBlock("usr_image_space"); $pd_set = new ilSetting("pd"); $osi_server = $pd_set->get("osi_host"); // if (trim($osi_server) != "") // { // instant messengers // 1 indicates to use online status check $im_arr = array("icq" => 0, "yahoo" => 1, "msn" => 0, "aim" => 0, "skype" => 1, "jabber" => 0, "voip" => 0); // use onlinestatus.org // when enabled all instant messengers are checked online and ignores settings above if (trim($osi_server) != "") { $osi_enable = true; } // removed calls to external servers due to // bug 10583, alex 8 Mar 2013 foreach ($im_arr as $im_name => $im_check) { if ($im_id = ilObjUser::_lookupIm($a_set["id"], $im_name)) { $im_url = ""; switch ($im_name) { case "icq": $im_url = "http://http://www.icq.com/people/" . $im_id; break; case "yahoo": $im_url = "http://edit.yahoo.com/config/send_webmesg?target=" . $im_id . "&src=pg"; break; case "msn": $im_url = "http://messenger.live.com"; break; case "aim": //$im_url = "aim:GoIM?screenname=".$im_id; $im_url = "http://aimexpress.aim.com"; break; case "skype": $im_url = "skype:" . $im_id . "?call"; break; } $im_img = ilUtil::getImagePath($im_name . 'online.png'); if ($im_url != "") { $this->tpl->setCurrentBlock("im_link_start"); $this->tpl->setVariable("URL_IM", $im_url); $this->tpl->parseCurrentBlock(); $this->tpl->touchBlock("im_link_end"); } $this->tpl->setCurrentBlock("instant_messengers"); $this->tpl->setVariable("IMG_IM_ICON", $im_img); $this->tpl->setVariable("TXT_IM_ICON", $lng->txt("im_" . $im_name)); $icon_id = "im_" . $im_name . "_usr_" . $a_set["id"]; $this->tpl->setVariable("ICON_ID", $icon_id); include_once "./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php"; ilTooltipGUI::addTooltip($icon_id, $lng->txt("im_" . $im_name) . ": " . $im_id, "", "top center", "bottom center"); $this->tpl->parseCurrentBlock(); } } // } } // username if (!$a_set["profile"]) { $this->tpl->setVariable("USR_LOGIN", $a_set["login"]); } else { if ($this->getCurrentDetailLevel() > 2) { $this->tpl->setVariable("USR_LOGIN", "<br />" . $a_set["login"]); } else { $this->tpl->setVariable("USR_LOGIN", " [" . $a_set["login"] . "]"); } } // profile link if ($a_set["profile"]) { include_once "Services/User/classes/class.ilUserUtil.php"; $user_name = ilUserUtil::getNamePresentation($a_set["id"], false, false, "", false, true, false); $this->tpl->setCurrentBlock("profile_link"); $this->tpl->setVariable("TXT_VIEW", $lng->txt("profile")); // see ilPersonalProfileGUI::getProfilePortfolio() $has_prtf = false; if ($ilSetting->get('user_portfolios')) { include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php"; $has_prtf = ilObjPortfolio::getDefaultPortfolio($a_set["id"]); } if (!$has_prtf) { // (simple) profile: center column $ilCtrl->setParameter($this, "user", $a_set["id"]); $this->tpl->setVariable("LINK_PROFILE", $ilCtrl->getLinkTargetByClass("ilpublicuserprofilegui", "getHTML")); } else { // portfolio: fullscreen include_once "Services/Link/classes/class.ilLink.php"; $this->tpl->setVariable("LINK_PROFILE", ilLink::_getLink($a_set["id"], "usr")); $this->tpl->setVariable("LINK_TARGET", "_blank"); } $this->tpl->setVariable("USR_ID", $a_set["id"]); $this->tpl->setVariable("LINK_FULLNAME", $user_name); $this->tpl->parseCurrentBlock(); } else { $this->tpl->setVariable("USR_FULLNAME", ""); } }
/** * Standard Version of Fill Row. Most likely to * be overwritten by derived class. */ protected function fillRow($a_set) { global $lng, $ilCtrl, $lng; include_once "./Services/Tracking/classes/class.ilLPMarks.php"; include_once "./Modules/Wiki/classes/class.ilWikiContributor.php"; if (ilObject::_exists($a_set["user_id"])) { arsort($a_set["pages"]); // pages foreach ($a_set["pages"] as $page_id => $cnt) { if ($page_id > 0) { include_once "./Modules/Wiki/classes/class.ilWikiPage.php"; $title = ilWikiPage::lookupTitle($page_id); $this->tpl->setCurrentBlock("page"); $this->tpl->setVariable("PAGE", $title); $this->tpl->setVariable("CNT", $cnt); $this->tpl->parseCurrentBlock(); } } $this->tpl->setVariable("TXT_LINKED_USER", $user["lastname"] . ", " . $user["firstname"] . " [" . $login . "]"); // profile link //$ilCtrl->setParameterByClass("ilpublicuserprofilegui", "user", $a_set["user"]); //$ilCtrl->setParameterByClass("ilpublicuserprofilegui", "back_url", // rawurlencode($ilCtrl->getLinkTarget($this->getParentObject(), $this->getParentCmd()))); //$this->tpl->setVariable("USER_LINK", // $ilCtrl->getLinkTargetByClass("ilpublicuserprofilegui", "getHTML")); $img = ilObjUser::_getPersonalPicturePath($a_set["user_id"], "xsmall"); $this->tpl->setVariable("IMG_USER", $img); $this->tpl->setVariable("TXT_NAME", $a_set["lastname"] . ", " . $a_set["firstname"]); $this->tpl->setVariable("USER_ID", $a_set["user_id"]); // comment for learner $this->tpl->setVariable("TXT_LCOMMENT", $lng->txt("wiki_comment_for_learner")); $this->tpl->setVariable("NAME_LCOMMENT", "lcomment[" . $a_set["user_id"] . "]"); $lpcomment = ilLPMarks::_lookupComment($a_set["user_id"], $this->parent_obj->object->getId()); $this->tpl->setVariable("VAL_LCOMMENT", ilUtil::prepareFormOutput($lpcomment)); // status //$status = ilExerciseMembers::_lookupStatus($this->object->getId(), $member_id); $status = ilWikiContributor::_lookupStatus($this->parent_obj->object->getId(), $a_set["user_id"]); $this->tpl->setVariable("SEL_" . $status, ' selected="selected" '); $this->tpl->setVariable("TXT_NOTGRADED", $lng->txt("wiki_notgraded")); $this->tpl->setVariable("TXT_PASSED", $lng->txt("wiki_passed")); $this->tpl->setVariable("TXT_FAILED", $lng->txt("wiki_failed")); $this->tpl->setVariable("VAL_NOTGRADED", ilWikiContributor::STATUS_NOT_GRADED); $this->tpl->setVariable("VAL_PASSED", ilWikiContributor::STATUS_PASSED); $this->tpl->setVariable("VAL_FAILED", ilWikiContributor::STATUS_FAILED); if (($sd = ilWikiContributor::_lookupStatusTime($this->parent_obj->object->getId(), $a_set["user_id"])) > 0) { $this->tpl->setCurrentBlock("status_date"); $this->tpl->setVariable("TXT_LAST_CHANGE", $lng->txt("last_change")); $this->tpl->setVariable("VAL_STATUS_DATE", ilDatePresentation::formatDate(new ilDateTime($sd, IL_CAL_DATETIME))); $this->tpl->parseCurrentBlock(); } switch ($status) { case ilWikiContributor::STATUS_PASSED: $pic = "scorm/passed.png"; break; case ilWikiContributor::STATUS_FAILED: $pic = "scorm/failed.png"; break; default: $pic = "scorm/not_attempted.png"; break; } $this->tpl->setVariable("IMG_STATUS", ilUtil::getImagePath($pic)); $this->tpl->setVariable("ALT_STATUS", $lng->txt("wiki_" . $status)); // mark $this->tpl->setVariable("TXT_MARK", $lng->txt("wiki_mark")); $this->tpl->setVariable("NAME_MARK", "mark[" . $a_set["user_id"] . "]"); $mark = ilLPMarks::_lookupMark($a_set["user_id"], $this->parent_obj->object->getId()); $this->tpl->setVariable("VAL_MARK", ilUtil::prepareFormOutput($mark)); } }
/** * Fill table row */ protected function fillRow($a_set) { global $ilCtrl, $lng; $this->tpl->setVariable("VAL_ID", $a_set["usr_id"]); if ($this->getType() == self::TYPE_GLOBAL_SEARCH) { include_once './Services/User/classes/class.ilUserUtil.php'; $link = ilUserUtil::getProfileLink($a_set['usr_id']); if ($link) { $this->tpl->setVariable('IMG_LINKED_TO_PROFILE', $link); $this->tpl->setVariable('USR_IMG_SRC_LINKED', ilObjUser::_getPersonalPicturePath($a_set['usr_id'], 'xsmall')); } else { $this->tpl->setVariable('USR_IMG_SRC', ilObjUser::_getPersonalPicturePath($a_set['usr_id'], 'xsmall')); } } foreach ($this->getSelectedColumns() as $field) { switch ($field) { case 'gender': $a_set['gender'] = $a_set['gender'] ? $this->lng->txt('gender_' . $a_set['gender']) : ''; $this->tpl->setCurrentBlock('custom_fields'); $this->tpl->setVariable('VAL_CUST', $a_set[$field]); $this->tpl->parseCurrentBlock(); break; case 'birthday': $a_set['birthday'] = $a_set['birthday'] ? ilDatePresentation::formatDate(new ilDate($a_set['birthday'], IL_CAL_DATE)) : $this->lng->txt('no_date'); $this->tpl->setCurrentBlock('custom_fields'); $this->tpl->setVariable('VAL_CUST', $a_set[$field]); $this->tpl->parseCurrentBlock(); break; case 'access_until': $this->tpl->setCurrentBlock('custom_fields'); $this->tpl->setVariable('CUST_CLASS', ' ' . $a_set['access_class']); $this->tpl->setVariable('VAL_CUST', $a_set[$field]); $this->tpl->parseCurrentBlock(); break; case 'last_login': $a_set['last_login'] = $a_set['last_login'] ? ilDatePresentation::formatDate(new ilDateTime($a_set['last_login'], IL_CAL_DATETIME)) : $this->lng->txt('no_date'); $this->tpl->setCurrentBlock('custom_fields'); $this->tpl->setVariable('VAL_CUST', $a_set[$field]); $this->tpl->parseCurrentBlock(); break; case 'login': if ($this->admin_mode) { $ilCtrl->setParameterByClass("ilobjusergui", "ref_id", "7"); $ilCtrl->setParameterByClass("ilobjusergui", "obj_id", $a_set["usr_id"]); $ilCtrl->setParameterByClass("ilobjusergui", "search", "1"); $link = $ilCtrl->getLinkTargetByClass(array("iladministrationgui", "ilobjusergui"), "view"); $a_set[$field] = "<a href=\"" . $link . "\">" . $a_set[$field] . "</a>"; } // fallthrough // fallthrough default: $this->tpl->setCurrentBlock('custom_fields'); $this->tpl->setVariable('VAL_CUST', (string) ($a_set[$field] ? $a_set[$field] : '')); $this->tpl->parseCurrentBlock(); break; } } if ($this->getType() == self::TYPE_GLOBAL_SEARCH) { $this->tpl->setVariable('SEARCH_RELEVANCE', $this->getRelevanceHTML($a_set['relevance'])); } }
function renderTitle() { global $tpl, $ilTabs, $lng; $tpl->resetHeaderBlock(); include_once "./Services/User/classes/class.ilUserUtil.php"; $tpl->setTitle(ilUserUtil::getNamePresentation($this->getUserId())); $tpl->setTitleIcon(ilObjUser::_getPersonalPicturePath($this->getUserId(), "xxsmall")); $back = $this->getBackUrl() != "" ? $this->getBackUrl() : $_GET["back_url"]; if ($back != "") { $ilTabs->clearTargets(); $ilTabs->setBackTarget($lng->txt("back"), $back); } }
/** * Render banner, user name * * @param object $a_tpl * @param int $a_user_id * @param bool $a_export_path */ public static function renderFullscreenHeader($a_portfolio, $a_tpl, $a_user_id, $a_export = false) { $name = ilObjUser::_lookupName($a_user_id); $name = $name["lastname"] . ", " . ($t = $name["title"] ? $t . " " : "") . $name["firstname"]; // show banner? $banner = $banner_width = $banner_height = false; $prfa_set = new ilSetting("prfa"); if ($prfa_set->get("banner")) { $banner = $a_portfolio->getImageFullPath(); $banner_width = $prfa_set->get("banner_width"); $banner_height = $prfa_set->get("banner_height"); if ($a_export) { $banner = basename($banner); } } // profile picture $ppic = null; if ($a_portfolio->hasProfilePicture()) { $ppic = ilObjUser::_getPersonalPicturePath($a_user_id, "xsmall", true, true); if ($a_export) { $ppic = basename($ppic); } } $a_tpl->resetHeaderBlock(false); // $a_tpl->setBackgroundColor($a_portfolio->getBackgroundColor()); $a_tpl->setBanner($banner, $banner_width, $banner_height, $a_export); $a_tpl->setTitleIcon($ppic); $a_tpl->setTitle($a_portfolio->getTitle()); // $a_tpl->setTitleColor($a_portfolio->getFontColor()); $a_tpl->setDescription($name); // to get rid of locator in portfolio template preview $a_tpl->setVariable("LOCATOR", ""); // :TODO: obsolete? // $a_tpl->setBodyClass("std ilExternal ilPortfolio"); }
/** * Render banner, user name * * @param object $a_tpl * @param int $a_user_id * @param bool $a_export_path */ public static function renderFullscreenHeader($a_portfolio, $a_tpl, $a_user_id, $a_export = false) { $name = ilObjUser::_lookupName($a_user_id); $name = $name["lastname"] . ", " . ($t = $name["title"] ? $t . " " : "") . $name["firstname"]; // show banner? $banner = $banner_width = $banner_height = false; $prfa_set = new ilSetting("prfa"); if ($prfa_set->get("banner")) { $banner = $a_portfolio->getImageFullPath(); $banner_width = $prfa_set->get("banner_width"); $banner_height = $prfa_set->get("banner_height"); if ($a_export) { $banner = basename($banner); } } // profile picture $ppic = null; if ($a_portfolio->hasProfilePicture()) { $ppic = ilObjUser::_getPersonalPicturePath($a_user_id, "big"); if ($a_export) { $ppic = basename($ppic); } } include_once "./Services/User/classes/class.ilUserUtil.php"; $a_tpl->setFullscreenHeader($a_portfolio->getTitle(), $name, $ppic, $banner, $a_portfolio->getBackgroundColor(), $a_portfolio->getFontColor(), $banner_width, $banner_height, $a_export); $a_tpl->setBodyClass("std ilExternal ilPortfolio"); }