Exemplo n.º 1
0
function display_add_log_entry($athlete_id, $parent_session, $split, $start_date, $error_message)
{
    // Check if this is a split or a parent session
    $extra = array("", "", "addlogentry");
    #  show_log_table($athlete_id, $split, $extra );
    #  if ( $split == "no" )
    #    // Not a split so fire up the session adding form
    session_form($parent_session, $athlete_id, $error_message, $start_date);
}
Exemplo n.º 2
0
function print_row($subyn, $level, $row, $details_to_view, $athlete_id, $split)
{
    # print the session details
    $parent_id = $row['parent_session'];
    $session_id = $row['session_id'];
    $previous_date = $GLOBALS['previous_date'];
    $start_date = $row['start_date'];
    $numcols = count($details_to_view);
    # Start the table row
    # echo "<TR>\n\n";
    print_split_expander_column($subyn, $session_id);
    #  foreach ( array_keys($row) as $key ) {
    #   if ( in_array( $key , $details_to_view ) ){
    unset($fullentry);
    $fullentry = array();
    //Find out what sort of entry type it is and use the appropriate
    //datacell class so the row gets the right background colour
    $row['session_type'] = trim($row['session_type']);
    $row['entry_type'] = trim($row['entry_type']);
    if ($row['session_type'] == "competition" && "X" . $row['entry_type'] == "X") {
        $datacell_class = get_datacell_class($row['session_type']);
    } else {
        $datacell_class = get_datacell_class($row['entry_type']);
    }
    foreach ($details_to_view as $key) {
        $entry = $row["{$key}"];
        $width = "";
        $expander = "";
        if (strlen($entry) > 20) {
            $width = "width=120";
            //put the full notes into fullentry
            $fullentry[$key] = $entry;
            // trim down displayed notes
            $entry = substr($entry, 0, 16);
            $expander = "<a onClick='reveal({$key}Note{$session_id}); return false' class=expander > +</a>\n";
        }
        if ($entry == "") {
            $entry = "&nbsp";
        }
        ##echo "\t\t<td class=datacell nowrap $width >$entry $expander </td>\n";
        echo "\t\t<td class={$datacell_class} >{$entry} {$expander} </td>\n";
    }
    // Check that the current user has permission to use these edit commands
    // on the athlete being viewed
    $viewer = $_SESSION['athlete_id'];
    if (check_share_permission($athlete_id, "edit log {$viewer}")) {
        # add a link to the end of each line to allow addition of sub-session
        # this will call the add_log_entry sending it the
        # session_id in _GET[parent_session]
        $session_id = $row['session_id'];
        echo "<td nowrap >";
        display_options_menu($session_id, $start_date);
        echo "\n</TD>\t</tr>\n";
    } else {
        echo "\n<TD>&nbsp;</TD>\n";
    }
    $num = $numcols + 1;
    foreach (array_keys($fullentry) as $key) {
        $notes = $fullentry[$key];
        echo <<<ENDHTML

\t<TR><TD border=0 cellpadding=0 cellspacing=0 class=firstcolumn ></TD><TD></TD><TD colspan={$num} >
\t<DIV ID='{$key}Note{$session_id}' class='hiddentext'> 
\t <TABLE cellpadding=0 cellspacing=0 > <TR><TD class=datacell ><b>{$key}:</b> {$notes} &nbsp;</TD></TR></TABLE> 
\t</DIV>
\t</TD></TR>


ENDHTML;
    }
    if ($split > 0) {
        # This function has been called by the add-user split function
        # and it is this session that is being split
        # so dislplay the add-user session form here
        $span = $num + 2;
        // Get the parent's start date
        $start_date = $row['start_date'];
        #echo "<TR><TD></TD><TD></TD><TD colspan=$span ><font size=2 >\n";
        echo "<TR><TD colspan={$span} ><font size=2 >\n";
        echo "<b>Insert Session Split Info</b>\n";
        session_form($session_id, $athlete_id, "", $start_date);
        echo "\t</TD></TR>\n\n";
    }
    #echo "</table>\n";
    # Set the global to the last start date so it can be compared on the next
    # time this is run so we know whether this is a new day or not.
    $GLOBALS['previous_date'] = $start_date;
}