Gegevens uit bestaande php ook in andere database invoeren

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Hans Jonker

Hans Jonker

27/02/2009 22:24:00
Quote Anchor link
Dag mensen,

ik heb een vraag.

ik wil in de onderstaande php code de mogelijkheid inbouwen om de gegevens van fullname en email weg te schrijven naar de databese table van de nieuwsbrieven wanneer de checkbox geactiveerd is.

De php hieronder komt uit de joomla component attend event en wanneer de mensen zich registreren kunnen ze d.m.v. een checkbox aangeven of ze ook de nieuwsbrief willen ontvangen en als dat zo is moeten de gegevens ook in het component Acajoom worden weg geschreven (table jos_acajoom_subscribers)

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
/**
* @version $Id: events_sessions.html.php,v 1.6 2004/12/18 03:14:47 tonanbarbarian Exp $
* @package Mambo_4.5.1
* @subpackage Events_Sessions
* @copyright (C) 2000 - 2004 Miro International Pty Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* Mambo is Free Software
*/

/** ensure this file is being included by a parent file */

defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

/* Update History
 * ------------------------------------------------------------------------------------------
 * 02/09/06 - viewSession :: Fixed "short tags" bug with venue fields.
 *          - cancelSession :: Removed hard-coded language.
 * 01/21/06 - displayRegistrations :: Fixed hard-coded language bug.
 * 01/12/06 - viewSession :: Added compatibility with CB's built-in avatars.
 * 12/18/05 - viewSession :: Show avatar thumbnail instead of full picture.
 * 12/17/05 - viewSession :: Forgot to code HTML generation for date and time of long events.
 * 12/15/05 - viewSession :: Moved mosMakeHtmlSafe calls to PHP file (they really belong
 *            there).  Fixed bug where  data from #__users overwrote contents of registered
 *            name and email fields.
 * 12/12/05 - viewSession :: mosMakeHtmlSafe called at the beginning of the function (is
 *            pass by reference, not pass by value so the original implementation didn't
 *            work).
 * 12/08/05 - viewSession :: mosMakeHtmlSafe called on each element of $row (to avoid messing
 *            up any WYSIWYG editor data.
 * 12/06/05 - viewSession :: Added call to mosMakeHtmlSafe($row)
 * 11/30/05 - Rebranded as Build 004.  Removed support for built-in registration fields.
 * 11/25/05 - listSessions :: BUGFIX: Displayed 'Full' for unlimited spaces.
 * 11/24/05 - viewSession :: Check admin config for determining whether to link to Google
 *            maps or not.
 * 11/23/05 - listSessions :: Minor HTML formatting tweaks.
 *          - viewSession :: Added error message if session is viewed, but session is full.
 * 11/19/05 - viewSession :: Added a link to Google Maps (based on scubaguy's code).
 * 11/14/05 - viewSession :: Added a check to see if the session information is being
 *              accessed before the registration period.  If that is the case, a warning
 *            message is displayed to the user.
 * 11/07/05 - viewSession :: Modified code for displaying custom fields.  HTML generation now
 *            takes place within the custom fields class.  
 *          - viewSession :: Incorporated scubaguy's code for displaying an event host (name
 *            only for now).
 * 11/03/05 - listSessions :: Produces code marked as standard Joomla classes -- i.e.,
 *            'sectiontableheader', 'sectionsectiontableentry1', ...
 *          - listSessions :: Uses
 *            $eSess["shortDateFormat"] for formatting.
 *          - viewSession :: Now supports registering individuals only.
 *          - viewSession :: Added 'Print' Button
 * 11/02/05 - listSessions :: Produces xhtml compliant code.
 *          - viewSessions :: Produces xhtml compliant code.
 * 11/01/05 - listSessions :: Both session start date and registration deadline dates are
 *            shown in the listing.
 * 10/29/05 - viewSession revised to include a loop at the end of table displaying the
 *            registration fields.  Each custom field for this session is displayed, and any
 *            possible values (radio, select, checkbox...) are loaded.
 * 10/21/05 - Added configuration options for integrating with "Community Builder" component.
 * 10/20/05 - Original "Events Sessions 0.6.0" code by Tony Blair
 */


class HTML_Events_Sessions {

/**
* Method that displays the Sessions list
*
* @param array $rows Array of Row objects
* @param string $option Component being accessed
* @param int $Itemid Id of the Mambo Item that displayed this
* @return void  
*/

function listSessions( &$rows, $option, $Itemid) {
        global $my, $mosConfig_live_site, $eSess;
        
        mosCommonHTML::loadOverlib();
?>

<br style="line-height: 5px;">
<table cellpadding="0" cellspacing="0" border="0" width="" class="">
<tr>
<th><div class="componentheading">
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo _ESESS_COMPONENT_TITLE; ?>
</div></th>
</tr>
</table>

<table cellpadding="0" cellspacing="0" border="0" width="100%" class="">
<thead>
<tr class="sectiontableheader">
<th style="text-align: left;">
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo _ESESS_NAME; ?>
</th>
<th style="text-align: left;">
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo _ESESS_SESSION_UP; ?>
</th>
</tr>
</thead>
<tbody>
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php
        $k
= 0;
        for ($i=0; $i < count( $rows ); $i++) {
            $row = &$rows[$i];
            // determine the number of registrations left
            if ($row->maxregistrations=='0') {
                $maxregistrations = $availregistrations = _ESESS_UNLIMITED;
            }
else {
                $maxregistrations = $row->maxregistrations;
                $availregistrations = ($row->maxregistrations-$row->numregistrations);
                if ($availregistrations<0) $availregistrations=0;
            }

            
            $url = "index.php?option=$option&amp;task=view&amp;id=$row->session_id&amp;Itemid=$Itemid";
?>

<tr class="
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo "sectiontableentry" . (($k % 2) + 1); ?>
">
<td style="text-align: left;"><a href="
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo $url; ?>
">
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo $row->title; ?>
</a></td>
<td style="text-align: left;">
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo mosFormatDate($row->session_up,$eSess["shortDateFormat"]); ?>
</td>
</tr>
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
<?php
            $k
= 1 - $k;
        }

?>

</tbody>
</table>
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<?php

    } // listSessions()
    
    
/**
* Function to display the details of a session in the front end
* and to display the registration fields
* @param array $rows Array of Row objects
* @param object $registration Registration Data object
* @param string $option Component being accessed
* @param array $lists Array of select list html
* @param int $Itemid Id of the Mambo Item that displayed this
* @return void
*/

function viewSession(&$row, $registration, $option, $lists, $Itemid, $customFields, $pop) {
        global $my, $eSess, $disableEvents, $database, $mosConfig_absolute_path, $mosConfig_lang, $mosConfig_live_site;
      
        // get the userid
        if (isset($registration->userid)) {
            $userid = $registration->userid;
        }
else {
            $userid = $my->id;
        }

        
        // determine what event information is displayed
        // check for subject

        $title = $row->title;
        if ($eSess["showSubject"] and !empty($row->subject)) {
            $title .= "(".$row->subject.")";
        }

        $title .= "\n";
        // check for times
        if ($eSess["showTimes"]) {
            $times = "";
            if (!empty($row->event_id)) {
                $times .= "<font size=\"1\">\n";
                
                // taken directly from components/com_events/events.html.php (with minor changes)
                // Id: events.html.php,v 1.23 2004/10/05 20:18:34 mleinmueller Exp

                require_once( $mosConfig_absolute_path."/components/com_events/events.html.php");
                // CHECK LANGUAGE
                if (!defined( '_CAL_LANG_INCLUDED' )) {
                    if (file_exists($mosConfig_absolute_path."/components/com_events/language/".$mosConfig_lang.".php") ) {
                        include_once($mosConfig_absolute_path."/components/com_events/language/".$mosConfig_lang.".php");
                    }
else {
                        include_once($mosConfig_absolute_path."/components/com_events/language/english.php");
                    }
                }

                if ($row->start_date == $row->stop_date) {
                    $times .= $row->start_date .",&nbsp;".$row->start_time."&nbsp;-&nbsp;".$row->stop_time."<br/>";
                }
else {
                    $times .= _CAL_LANG_FROM."&nbsp;".$row->start_date."&nbsp;-&nbsp;".$row->start_time."<br />".
                        _CAL_LANG_TO."&nbsp;".$row->stop_date."&nbsp;-&nbsp;".$row->stop_time."<br/>";
                
                    if ($row->reccurtype > 0) {                
                        switch ($row->reccurtype) {
                            case
"1": $reccur = _CAL_LANG_REP_WEEK;break;              
                            case
"2": $reccur = _CAL_LANG_REP_WEEK;break;
                            case
"3": $reccur = _CAL_LANG_REP_MONTH;break;
                            case
"4": $reccur = _CAL_LANG_REP_MONTH;break;
                            case
"5": $reccur = _CAL_LANG_REP_YEAR;break;                  
                        }

                        if ($row->reccurday >= 0) {
                            $dayname = mosEventsHTML::getLongDayName($row->reccurday);        
                            if ($row->reccurtype == 1) {                
                                $times .= $dayname."&nbsp;"._CAL_LANG_EACHOF."&nbsp;".$reccur;
                            }
elseif (($row->reccurtype == 1) || ($row->reccurtype == 2)) {
                                $pairorimpair = $row->reccurweeks == "pair" ? _CAL_LANG_REP_WEEKPAIR : ($row->reccurweeks == "impair" ? _CAL_LANG_REP_WEEKIMPAIR : _CAL_LANG_REP_WEEK);
                                $times .= _CAL_LANG_EACH."&nbsp;".$dayname."&nbsp;".$pairorimpair."";
                            }
else {
                                $times .= _CAL_LANG_EACH."&nbsp;".$reccur;
                            }
                        }
else {
                            $times .= _CAL_LANG_EACH."&nbsp;".$reccur;
                        }          
                    }
else {
                        if($row->start_date != $row->stop_date) $times .= _CAL_LANG_ALLDAYS;
                    }
                }

                
                $times .= "          </font>\n" .
                "          <br />\n";
            }
        }

        // check for activity
        if ($eSess["showActivity"] and !empty($row->activity)) {
            $activity = "<tr align=\"left\" valign=\"top\">\n" .
                "        <td colspan=\"2\">\n" .
                "          $row->activity\n" .
                "        </td>\n" .
                "      </tr>\n";
        }

        // check for contact and location
        if (($eSess["showContact"] and !empty($row->contact)) or ($eSess["showLocation"] and !empty($row->location))) {
            $contactLocation = "<tr>\n" .
                "        <td colspan=\"2\" align=\"left\" valign=\"top\">\n" .
                "          <br />\n" .
                "          <font size=\"1\">\n";
            if ($eSess["showContact"] and isset($row->contact)) {
                $contactLocation .= "          $row->contact<br />\n";
            }

            if ($eSess["showLocation"] and isset($row->location)) {
                $contactLocation .= "          $row->location<br />\n";
            }

            $contactLocation .= "          </font>\n" .
                "        </td>\n" .
                "      </tr>\n";
        }

        // check for extra
        if ($eSess["showExtra"] and !empty($row->extra)) {
            $extra = "<tr>\n" .
                "        <td colspan=\"2\" align=\"left\" valign=\"top\">$row->extra</td>\n" .
                "      </tr>\n";
        }

        
        // determine the number of available registrations
        if (!$eSess["autoFull"]) {
            $availregistrations = -1;
        }
elseif ($row->maxregistrations=='0') {
            $availregistrations = -1;
        }
else {
            $availregistrations = ($row->maxregistrations-$row->numregistrations);
            if ($availregistrations<0) $availregistrations=0;
        }

        
        // check for numbers
        if ($eSess["userNumber"]) {
            $number = "<tr>\n<td>" . _ESESS_REG_AVAIL . ":</td>\n<td>";
                
            if ($row->maxregistrations==0) {
                $number .= _ESESS_UNLIMITED."\n";
            }
else {
                 if ($availregistrations<0) {
                    $number .= "0";
                 }
else {
                    $number .= $availregistrations;
                 }

                $number .= " "._ESESS_OUT_OF." $row->maxregistrations\n";
            }

            $number .="        </td>\n" .
                "      </tr>\n";
        }

        


        
        // prepare the form action
        $action = "index.php?option=$option&amp;Itemid=$Itemid";
        
        // display the html of the form
        require_once($mosConfig_absolute_path . '/administrator/components/com_attend_events/fields.attend_events.php');
        JS_AE_CustomFields_FrontEnd::insertCustomFieldScripts($row->session_id);
?>


<script language="javascript" type="text/javascript">
<!-- to hide script contents from old browsers
function submitbutton(pressbutton) {
var form = document.registrationForm;
var availableRegistrations =
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo $availregistrations; ?>
;
var msg = "";

if (pressbutton!='cancel') {
// do some validation first

// check that name is entered
if (form.fullname.value=='') {
msg += "
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo _ESESS_VAL_REG_FULLNAME; ?>
\n";
}

// check the email address
if (form.email.value=='') {
msg += "
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo _ESESS_VAL_REG_EMAIL; ?>
\n";
} else {
// any extra email validation here
}

// check numregistrations
var numOk = true;
if (form.numregistrations.value=='') {
numOk = false;
} else if (!isPosInteger(form.numregistrations.value)) {
numOk = false;
} else if (form.numregistrations.value=='0') {
numOk = false;
} else if (form.numregistrations.value > availableRegistrations) {
if (availableRegistrations!=-1) numOk = false;
}
if (!numOk) {
msg += "
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo _ESESS_VAL_REG_NUMBER; ?>
"+availableRegistrations+".\n";
}
// end of validation
}

// check custom fields
msg += validateInput();

// check to see if we are ok to submit
if (msg=='') {
// no message so we can submit
form.task.value=pressbutton;
form.submit();
} else {
// display validation error
alert("
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo _ESESS_VAL_REG_ALERT; ?>
\n\n"+msg);
}
}

function isPosInteger(inputVal) {
inputStr = inputVal.toString();
for (var i = 0; i < inputStr.length; i++) {
var oneChar = inputStr.charAt(i);
if (oneChar < "0" || oneChar > "9") {
return false;
}
}
return true;
} // isPosInteger()

// end hiding contents from old browsers -->
</script>
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
<?php
    mosCommonHTML::loadOverlib();
?>


<form action="
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo $action; ?>
" method="post" name="registrationForm">
<table class="contentpaneopen">
<tr>
<td class="contentheading">
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo $title; ?>
</td>
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php


// Set-up the parameters object.
$params = & new mosParameters( '' );
$params->def( 'print', true );
if ($pop) {
$params->def( 'popup', true );
}
else {
$params->def( 'popup', false );
}

$params->def( 'icons', true );
 
// Set-up the URL that will be opened if the print icon is clicked.
$url = $mosConfig_live_site . '/index2.php?option=' . $option . '&amp;task=view&amp;pop=1&amp;id=' .
      $row->session_id;
 
 
// Draw the Print icon.
//global $hide_js;
//mosHTML::PrintIcon( $row, $params, $hide_js, $url );




?>

</tr>
</table>
<table class="" width="490" border="0" cellpadding="3">
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
<?php    /* Edited by GPKC on 11/07/05
         * Display the event host (if defined)
         */
        
         if (!empty($registration->host_name)) { ?>

<!-- <tr>
<td colspan="2" class="small">
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php // echo _ESESS_REG_HOSTED_BY; ?>
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php //echo $registration->host_name; ?>

</td>
</tr>

<tr>
<td align="right" valign="top">
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php // echo $times; ?>
</td>
<td>&nbsp;</td>
</tr>
-->
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php } /* if host_name not empty */ ?>


<tr align="left" valign="top">
<td colspan="2">
<br style="line-height: 5px;">
<font class="grijs" style="line-height: 17px;"><b>
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo $row->introtext; ?>
</b></font>
<br><br>
</td>
</tr>
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo $activity; ?>

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo $contactLocation; ?>

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo $extra; ?>

<tr>
<td valign="baseline" width="130">
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo _ESESS_REG_DATETIME; ?>
:</td>
<td valign="baseline">
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php  /* Edited by GPKC on 11/05/05
                          * Date and time should be displayed differently for multi-day sessions
                          */

                      
                          $up_date = strftime($eSess["shortDateFormat"],strtotime($row->session_up));
                          $down_date = strftime($eSess["shortDateFormat"],strtotime($row->session_down));
                          
                          
                          $singleDaySession = ((strtotime($row->session_down) - strtotime($row->session_up)) < 12*60*60) ? 1 : 0;
                          
                          if ($singleDaySession) {
                              echo strftime($eSess["longDateFormat"],strtotime($row->session_up));
                              echo ", ";
                              echo strftime($eSess["timeFormat"],strtotime($row->session_up));
                              echo " &mdash; ";
                              echo strftime($eSess["timeFormat"],strtotime($row->session_down));
                          }
else {
                              echo strftime($eSess["longDateFormat"],strtotime($row->session_up)) . ", " . strftime($eSess["timeFormat"],strtotime($row->session_up)) . " <br>tot<br> " . strftime($eSess["longDateFormat"],strtotime($row->session_down)) . ", " . strftime($eSess["timeFormat"],strtotime($row->session_down));
                          }

                  ?>

</td>
</tr>

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
<?php /* Show Session Location? */
                if (!empty($row->venue_name) or !empty($row->venue_address) or !empty($row->venue_city) or !empty($row->venue_state) or !empty($row->venue_postalcode) or !empty($row->venue_country)) {
        ?>

<tr>
<td valign="top">
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo _ESESS_REG_LOCATION; ?>
:
</td>
<td valign="top">
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php if (!empty($row->venue_name)) echo $row->venue_name . "<br />"; ?>

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
<?php if (!empty($row->venue_address)) {
                         echo $row->venue_address;
                         if ($eSess["showMap"]) echo " ( <a href=\"http://maps.google.com/maps?q=" . $row->venue_address . "+" . $row->venue_city . "+" . $row->venue_state . "+" . $row->venue_postalcode ."\" title=\"" . _ESESS_REG_MAPTEXT . "\">map</a> )";
                         echo "<br />";
                     }
?>

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php if (!empty($row->venue_city)) echo $row->venue_city . ", "; ?>

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php if (!empty($row->venue_state)) echo $row->venue_state . "<br />"; ?>

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php if (!empty($row->venue_postalcode)) echo $row->venue_postalcode . "<br />"; ?>

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php if (!empty($row->venue_country)) echo $row->venue_country . "<br />"; ?>

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php if (!empty($row->venue_webaddress)) echo "<a href=\"" . $row->venue_webaddress . "\">" . $row->venue_webaddress . "</a><br />"; ?>

</td>
</tr>
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php } ?>

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo $number; ?>

<tr>
<td>
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo _ESESS_REG_CLOSE; ?>
:
</td>
<td>

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
<?php
                echo strftime($eSess["longDateFormat"],strtotime($row->registration_down));
                
                //aangepast omdat de dag niet zichtbaar werd, nu wel
                //echo mosFormatDate($row->registration_down);
?>

</td>
</tr>
</table>


Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php    /* Edited by GPKC on 11/14/05
         * Check to see whether the registration form should be displayed.
         * For instance, a session may be listed even though the registration
         * period hasn't begun, or sessions may be displayed to all users
         * including guests, but only registered users can register.
         */

        
         $errorMsg = "";
        
         if ($row->status==0)  $errorMsg = "Registratie voor deze conferentie begint op " . strftime($eSess["longDateFormat"],strtotime($row->registration_up));
        
         $allowedUsers = array();
         switch ($row->availability) {
             case
"0" :    // Session Set to Everyone
                     $allowedUsers[] = "Guest";
                     $allowedUsers[] = "Registered";
                 break;
             case
"1" :    // Session Set to Registrered Users Only
                     $allowedUsers[] = "Registered";
                 break;
             case
"2" :
                     $allowedUsers[] = "Guest";
                 break;
             case
"3" :
                    switch ($eSess["registrationsFrom"]) {
                        case
"0" :    // Session Set to Everyone
                                $allowedUsers[] = "Guest";
                                $allowedUsers[] = "Registered";
                            break;
                        case
"1" :    // Session Set to Registrered Users Only
                                $allowedUsers[] = "Registered";
                            break;
                        case
"2" :
                                $allowedUsers[] = "Guest";
                            break;
                    }
    
                 break;
         }


        
        if ((array_search("Guest",$allowedUsers) === false) && (!$my->id)) {
            $errorMsg = _ESESS_ERROR_ONLY_REGISTERED;
        }

        if ((array_search("Registered",$allowedUsers) === false) && ($my->id)) {
            $errorMsg = _ESESS_ERROR_ONLY_GUESTS;
        }


        
        if ($eSess["autoFull"] && ($availregistrations <= 0) && ($row->maxregistrations > 0)) {
            $errorMsg = _ESESS_ERROR_FULL;
        }

        
        
        if (empty($errorMsg)) {
             HTML_Events_Sessions::displayRegistrationForm($option, $registration, $customFields);
        }
else {
?>

<table cellpadding="3" cellspacing="0" border="0" class="">
<tr>
<td>
<h3>
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo $errorMsg; ?>
</h3>
</td>
</tr>
</table>
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
<?php
        } // else of if (empty($errorMsg))
        
        /* Edited by GPKC on 11/25/05
         * If necessary, call function to display who has already registered
         */

        if ($eSess["showRegistered"]) {
            HTML_Events_Sessions::displayRegistrations($row);
        }

?>



Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php    if ($eSess["individualOnly"]) { ?>

<input type="hidden" name="numregistrations" value="1" />
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php    } ?>

<input type="hidden" name="registration_id" value="
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo $registration->registration_id; ?>
" />
<input type="hidden" name="session_id" value="
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo $row->session_id; ?>
" />
<input type="hidden" name="id" value="
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo $row->session_id; ?>
" />
<input type="hidden" name="userid" value="
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo $userid; ?>
" />
<input type="hidden" name="task" value="" />
</form>
<br />
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
    }  // viewSession()
  
  
    function displayRegistrations(&$row) {
        global $database, $mosConfig_live_site, $mosConfig_lang, $eSess;
        
        /* Edited by GPKC on 11/25/05
         * Original Code from Michael Spredemann (scubaguy), which was based on
         * Buddy Hack by Ford on http://www.mambojoe.com
         * Revised by Peter Carr (GPKC) to conditionally deal with guests and community builder
         */

        // query for people already registered

        $query  = "SELECT * FROM #__events_registrations ";
        $query .= "WHERE session_id='".$row->session_id."' AND cancel_date='0000-00-00 00:00:00' ";
        $query .= "ORDER BY fullname ASC";
        $database->setQuery($query);
        $registrants = $database->loadObjectList();


        if (count($registrants) > 0) {
            echo "<h3>" . _ESESS_REG_LIST . "</h3>";
        
            foreach ($registrants as $registrant) {            
                if ($eSess["cbIntegrated"] && $eSess["showAvatar"]) {
                    // Load the avatar picture.  For guests, display the appropriate no_picture file...
                    if ($registrant->userid) {
                        $query = "SELECT avatar FROM #__comprofiler WHERE user_id='".$registrant->userid."' AND avatarapproved=1";
                        $database->setQuery( $query );
                        $avatarFileName = $database->loadObjectList();
                        if ($avatarFileName[0]->avatar) {
                            /* Edited by GPKC on 01/12/06
                             * Some photos may be from the gallery, while others may be user submitted
                             */

                            if (strcmp("gallery", substr($avatarFileName[0]->avatar, 0, 7))) {
                                $avatarImgPath = $mosConfig_live_site . "/images/comprofiler/tn" . $avatarFileName[0]->avatar;
                            }
else {
                                $avatarImgPath = $mosConfig_live_site . "/images/comprofiler/" . $avatarFileName[0]->avatar;
                            }
                        }
else {
                            $avatarImgPath = $mosConfig_live_site . "/components/com_comprofiler/images/" . $mosConfig_lang . "/tnnophoto.jpg";
                        }
                    }
else {
                        $avatarImgPath = $mosConfig_live_site . "/components/com_comprofiler/images/" . $mosConfig_lang . "/tnnophoto.jpg";
                    }
                }

                
                // Display Avatar
                echo "<img src=\"" . $avatarImgPath . "\" alt=\"\" align=\"left\" />";
                echo $registrant->fullname . "<br />";
                echo $registrant->comments . "<br clear=\"left\" /><br />";
            
            }
//foreach ($registrants as $registrant)
        } // if (count($registrants) > 0)
    } // displayRegistrations
    
    
    
    
    
    
    
  
    function displayRegistrationForm($option, &$registration, &$customFields) {
           global $eSess, $mosConfig_absolute_path;
?>

<table class="" width="490" border="0" cellpadding="3">
<tr>
<td width="130">
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo _ESESS_FIELD_FULLNAME.":&nbsp;"._ESESS_REQUIRED; ?>

</td>
<td>
<input style="width: 250px;" class="inputbox" type="text" name="fullname" tabindex="1" value="
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo $registration->fullname; ?>
" size="50" maxlength="100" />
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo returnToolTip( "_ESESS_FIELD_FULLNAME" )."\n"; ?>

</td>
</tr>
<tr>
<td>
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo _ESESS_FIELD_EMAIL.":&nbsp;"._ESESS_REQUIRED; ?>

</td>
<td>
<input style="width: 250px;" class="inputbox" type="text" name="email" tabindex="2" value="
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo $registration->email; ?>
" size="50" maxlength="254" />
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo returnToolTip( "_ESESS_FIELD_EMAIL" )."\n"; ?>

</td>
</tr>
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php    if (!$eSess["individualOnly"]) { ?>

<tr>
<td>
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo _ESESS_FIELD_NUM_PEOPLE.":&nbsp;"._ESESS_REQUIRED; ?>

</td>
<td>
<input class="inputbox" type="text" name="numregistrations" tabindex="3" value="
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo $registration->numregistrations ? $registration->numregistrations : '1'; ?>
" size="4" maxlength="4" />
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo returnToolTip( "_ESESS_FIELD_NUM_PEOPLE" )."\n"; ?>

</td>
</tr>
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php    } // individual only
    
       /* Edited by GPKC on 10/29/05
        * Show custom fields...
        * Edited by GPKC on 11/07/05
        * Code incorporated into a class for ease of use.
        */

        
        require_once( $mosConfig_absolute_path."/administrator/components/$option/fields.attend_events.php" );
        
        foreach($customFields as $customField) {
            echo "<tr>\n";
            echo "\t<td>";
            HTML_AE_CustomFields::printFieldTitle($customField);
            echo "</td>\n";
            
            echo "\t<td>\n";
            HTML_AE_CustomFields::printFieldInput($customField);
            echo "\t</td>\n";
            echo "</tr>\n";
        }




        if ($eSess["showRegistered"]) { ?>

<tr>
<td valign="baseline">
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo _ESESS_FIELD_COMMENTS; ?>
</td>
<td>
<textarea name="comments" rows="4" cols="40">
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo $registration->comments; ?>
</textarea>
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo returnToolTip( "_ESESS_FIELD_COMMENTS" )."\n"; ?>

</td>
</tr>
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php    } ?>


<tr>

<td>Ik meld me aan voor de nieuwsbrief</td>
<td><input type="checkbox" name="nieuwsbrief_conferenties" value="1" checked="checked" /></td>

</tr>

<tr>
<td colspan="2" align="center">
<br>
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
<?php
            if (isset($registration->userid)) {
            // registered user with previous registration
            // so display all buttons

?>

<input type="button" name="register" value="
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo _ESESS_BUTTON_UPDATE; ?>
" onclick="submitbutton('update');" />
<input type="reset" value="
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo _ESESS_BUTTON_RESET; ?>
" />
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
<?php
                if ($eSess["userCancellation"]) {
                // allow the user to cancel
?>

<input type="button" name="cancel" value="
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo _ESESS_BUTTON_CANCEL; ?>
" onclick="submitbutton('cancel');" />
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
<?php
                }
            }
else {
            // guest or registered user without previous registration
?>

<input type="button" name="register" value="
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo _ESESS_BUTTON_REGISTER; ?>
" onclick="submitbutton('register');" />
<input type="reset" value="
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo _ESESS_BUTTON_RESET; ?>
" />

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
<?php
            }
?>

</td>
</tr>
</table>
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php    
   } // displayRegistrationForm
  
  
  
  
  
  
  
    
    
    /**
    * Function to display the cancellation message
    *
    * @param string $title Title of the session just cancelled from
    * @param string $url Url that leads back to the session just cancelled from
    * @oaram string $fullname Name of the person who just cancelled
    * @return void
    */

function cancelSession($title, $text) {
?>

<div class="contentheading">
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo $title ?>
</div>
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo $text; ?>

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
<?php
    } // cancelSession()








} // class - HTML_Events_Sessions
?>

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
<?php
    if
 
PHP hulp

PHP hulp

28/04/2024 22:03:57
 
Jo colling

jo colling

27/02/2009 22:27:00
Quote Anchor link
Probeer is een beetje commentaar weg te halen en tussen code tags te zetten.
 
TJVB tvb

TJVB tvb

27/02/2009 22:28:00
Quote Anchor link
Ik geloof zomaar dat je meer wilde plaatsen dan er in het vak paste. Misschien is dat een indicatie voor je dat het veeeeel meeeer code is dan de relevante code. Ga eerst eens kijken wat je zelf kunt doen.
Als je gerichte vragen hebt kun je die altijd stellen.

En zet je code tussen
 



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.