Beispiel #1
0
function new_fields($user_id)
{
    // User muß Admin sein, sonst wird die Funktion nicht ausgeführt
    // GW 150730
    if (!current_user_can('manage_options')) {
        return false;
    }
    $editAllowed = current_user_can('manage_options');
    $fields = array(USER_GENDER => 'datr_gender', USER_TITLE => 'datr_title', USER_MANDANT => 'datr_mandantID', USER_DEPARTMENT => 'datr_department');
    $output = '<h3>' . USER_PROFILE_EXTRA_FIELDS . '</h3>
    <table class="form-table">';
    $output .= "<tr>\n        <th>" . LANGUAGE . "</th>\n            <td>" . View::outputOptions("datr_language", DaschugLocalisation::$languages, get_user_meta($user_id->ID, 'datr_plugin_language', true)) . "</td></tr>";
    foreach ($fields as $key => $value) {
        //View::userFormFieldsOutput($value, get_user_meta($user_id->ID, $value, true), $editAllowed);
        $output .= "<tr>\n            <th>{$key}</th>\n            <td>" . View::userFormFieldsOutput($value, get_user_meta($user_id->ID, $value, true), $editAllowed) . "</td>\n        </tr>";
    }
    $userLocations = EventDatabaseManager::getUserLocations($user_id->ID);
    $locations = EventDatabaseManager::getMandantLocations(get_user_meta($user_id->ID, 'datr_mandantID', true));
    $output .= View::outputUserLocations($locations, $userLocations, $editAllowed);
    $output .= '</table>';
    $output .= '<h3>' . USER_PROFILE_YOUR_ASSIGNMENTS . '</h3>
    <table class="form-table">';
    $output .= '<tr><td></td><td>' . ASSIGNMENTS_TITLE . '</td>';
    foreach (EventDatabaseManager::$userHasTopicsParams as $title => $key) {
        if ($key == 'repetition_frequency_days' or $key == 'topic_expiry_date') {
            // GW 140611
            $output .= "<td>" . $title . "</td>";
        }
    }
    $output .= '</tr>';
    echo $output;
    $topics = EventDatabaseManager::getAllTopics();
    foreach ($topics as $id => $title) {
        View::userHasTopicForm($id, $title, EventDatabaseManager::getAssignedTopicParams($user_id->ID, $id), $editAllowed);
    }
    echo "</table>";
    echo "<script src=\"/wp-content/plugins/daschug/check_user_meta.js\" type=\"text/javascript\"></script>";
}
Beispiel #2
0
 /**
  * Outputs the list of event participants and their current statuses
  * @param array $participants
  * @param Event $event
  */
 public static function outputParticipantsList($participants, $event)
 {
     $output = View::outputEventInfo($event, array(EVENT_TITLE_LONG => 'title_long', EVENT_TITLE_SHORT => 'title_short', EVENT_DATE_TIME => 'date_time'));
     $output .= "<h3>" . PARTICIPANTS . "</h3><form action = '' method = 'post' name = 'participants'>" . "<table>";
     foreach ($participants as $participant) {
         $user = get_userdata($participant['userID']);
         $output .= '<tr><td>' . $user->data->display_name . '</td><td>' . View::outputOptions('status_user' . $user->ID, array(STATUS_COMPLETED => STATUS_COMPLETED_TITLE, STATUS_SIGN_IN => STATUS_SIGNED_IN_TITLE, STATUS_MISSED => STATUS_MISSED_TITLE, STATUS_SIGN_OUT => STATUS_SIGNED_OUT_TITLE), $participant['status'], false);
         $output .= '</td></tr>';
     }
     $output .= "</table>";
     if (!empty($participants)) {
         $output .= "<input type = 'submit' value = '" . BUTTON_SUBMIT . "'>";
     }
     $output .= "</form>";
     echo $output;
 }