// Userpage bearbeiten // Userpage bearbeiten case 'change': $userpage->changeData($tpl_dir, $lang_file); break; } } //======================================================= // Admin - Aktionen //======================================================= if (defined('ACP') && !empty($_REQUEST['moduleaction'])) { require_once BASE_DIR . '/modules/userpage/class.userpage.php'; require_once BASE_DIR . '/modules/userpage/func/func.replace.php'; $tpl_dir = BASE_DIR . '/modules/userpage/templates/'; $lang_file = BASE_DIR . '/modules/userpage/lang/' . $_SESSION['user_language'] . '.txt'; $userpage = new userpage(); $AVE_Template->config_load($lang_file, 'admin'); $config_vars = $AVE_Template->get_config_vars(); $AVE_Template->assign('config_vars', $config_vars); switch ($_REQUEST['moduleaction']) { // Einstellungen case '1': $userpage->showSetting($tpl_dir); break; // Neues Feld // Neues Feld case 'save_new': $userpage->saveFieldsNew($tpl_dir); break; // Speichern // Speichern
<?php require_once "functions/bootstrap.php"; require_once CLASS_DIR . "/user.class.php"; $kibopage = new userpage(); $kibopage->run();
/** * Unassign the usersets from the user. * * @param array $elements An array containing information on usersets to unassign from the user. * @param bool $bulkaction Whether this is a bulk-action or not. * @return array An array to format as JSON and return to the Javascript. */ protected function _respond_to_js(array $elements, $bulkaction) { global $DB; $userid = required_param('id', PARAM_INT); // Permissions. $upage = new userpage(); if ($upage->_has_capability('local/elisprogram:user_view', $userid) !== true) { return array('result' => 'fail', 'msg' => get_string('not_permitted', 'local_elisprogram')); } foreach ($elements as $usersetid => $label) { if ($this->can_unassign($userid, $usersetid) === true) { $assignrec = $DB->get_record(clusterassignment::TABLE, array('userid' => $userid, 'clusterid' => $usersetid)); if (!empty($assignrec) && $assignrec->plugin === 'manual') { $usertrack = new clusterassignment($assignrec); $usertrack->delete(); } } } return array('result' => 'success', 'msg' => 'Success'); }
/** * Takes a record and transforms it into an appropriate format * This method is set up as a hook to be implented by actual report class * * @param stdClass $record The current report record * @param string $export_format The format being used to render the report * @uses $CFG * @return stdClass The reformatted record */ function transform_record($record, $export_format) { global $CFG; $showcurricula = $this->check_curricula(); if (isset($record->id)) { //add a default curriculum name if appropriate if ($showcurricula && (empty($record->curid) || empty($record->name))) { if (!empty($record->preservecurname)) { //actually corresponds to class enrolments $record->name = get_string('noncurriculumcourses', $this->languagefile); } else { //doesn't correspond to anything $record->name = get_string('na', $this->languagefile); } } //link curriculum name to its "view" page if the the current record has a curriculum if ($export_format == table_report::$EXPORT_FORMAT_HTML && !empty($record->curid)) { $page = new curriculumpage(array('id' => $record->curid, 'action' => 'view')); if ($page->can_do()) { $url = $page->url; $record->name = '<span class="external_report_link">' . "<a href=\"{$url}\" target=\"_blank\">{$record->name}</a></span>"; } } //base url $url = "{$CFG->wwwroot}/local/elisreports/render_report_page.php"; //params being passed via url $url_params = array('report' => 'user_class_completion_details', 'filter-up-idnumber' => urlencode($record->useridnumber), 'filter-up-idnumber_op' => generalized_filter_text::$OPERATOR_IS_EQUAL_TO); $preferences = php_report_filtering_get_user_preferences($this->reportname); if (!empty($preferences)) { foreach ($preferences as $key => $val) { // Determine if this is one of the completion range filter values preg_match('/.+\\/(filter\\-completerange\\_[a-z]{3})/', $key, $matches); if (isset($matches[1])) { $url_params[$matches[1]] = $val; } } } //used to track whether to add a ? or a & $first = true; foreach ($url_params as $key => $value) { //append the parameter to the url if ($first) { $url .= '?'; } else { $url .= '&'; } $url .= "{$key}={$value}"; //signal the use of & on subsequent iterations $first = false; } //add parameters related to all these groups to the report $groupnames = array('filter-detailheaders', 'filter-detailcolumns'); foreach ($groupnames as $groupname) { if ($first) { $url .= '?'; } else { $url .= '&'; } $url .= $this->get_param_url_string($groupname); } //extra attributes we are including in the anchor tag $tag_attributes = array('target' => '_blank'); //build the additional attributes $attribute_string = ''; foreach ($tag_attributes as $key => $value) { $attribute_string .= " {$key}={$value}"; } // details label for the link. First check to see if this is the first instance of the // student's record. If so then show the details link. $record->id = ''; if ($this->student_id_num != $record->useridnumber) { $link_text = get_string('details', $this->languagefile); $this->student_id_num = $record->useridnumber; $record->id = '<span class="external_report_link"><a href="' . $url . '"' . $attribute_string . '>' . $link_text . '</a></span>'; } } //show link to user's profile based on capability to view the student management capability $fullname = php_report::fullname($record); if ($export_format == php_report::$EXPORT_FORMAT_HTML) { $userpage = new userpage(array('id' => $record->userid, 'action' => 'view')); if ($userpage->can_do()) { $record->lastname = '<span class="external_report_link"><a href="' . $userpage->url . '" target="_blank">' . $fullname . '</a></span>'; } else { $record->lastname = $fullname; } } else { $record->lastname = $fullname; } //convert times to appropriate format if (!empty($record->timecompleted) && !empty($record->completed)) { $record->timecompleted = $this->format_date($record->timecompleted); } else { $record->timecompleted = get_string('na', $this->languagefile); } if (!empty($record->timeexpired) && !empty($record->completed)) { $record->timeexpired = $this->format_date($record->timeexpired); } else { $record->timeexpired = get_string('na', $this->languagefile); } //N/A for cretificate number if a valid one is not set if (empty($record->certificatecode) || empty($record->completed)) { $record->certificatecode = get_string('na', $this->languagefile); } //copy result of complex query into simple field if (!empty($record->numcredits)) { //use the provided value $record->displaynumcredits = $this->format_credits($record->numcredits); } else { //default to zero $record->displaynumcredits = $this->format_credits(0); } //handle custom field default values and display logic $this->transform_custom_field_data($record); return $record; }
<?php /* <Orion, a web development framework for RK.> Copyright (C) <2011> <Orion> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ define('IN_APP', true); require_once('./interfase/common.php'); require_once(ROOT . 'objects/userpage.php'); $user->init(); $user->setup(); $userpage = new userpage(); $userpage->run(); page_layout($userpage->get_title(), $userpage->get_template());
/** * Formats the timecreated parameter, if present, and adds a link to view the user's ELIS profile around the idnumber parameter. * * @param array $row An array for a single result. * @return array The transformed result. */ protected function results_row_transform(array $row) { if (isset($row['element_timecreated'])) { $row['element_timecreated'] = ds_process_displaytime($row['element_timecreated']); } // Add link to view profile for idnumber column. if (isset($row['element_idnumber'])) { $usermanagementpage = new userpage(); $classid = optional_param('id', null, PARAM_INT); if ($classid !== null && $usermanagementpage->can_do_view()) { $target = $usermanagementpage->get_new_page(array('action' => 'view', 'id' => $row['element_id'])); $idnumber = $row['element_idnumber']; $row['element_idnumber'] = '<a href="' . $target->url . '" alt="ELIS profile" title="ELIS profile">' . $idnumber . '</a>'; } } return $row; }
/** * Determine whether the current user has permissions to view the link to a * user's individual user report page */ function can_do_default() { global $USER; //obtain the target user's PM user id $id = $this->required_param('userid', PARAM_INT); //obtain the target user's PM user id $cmuserid = cm_get_crlmuserid($USER->id); if ($cmuserid != 0 && $cmuserid == $id) { //looking at your own report, and you have a PM user id return true; } //regular permissions check // TODO: Ugly, this needs to be overhauled $upage = new userpage(); return $upage->_has_capability('local/elisreports:view', $id); }