1
marijun
i need some fresh eyes and/or a guru :)
  • 2005/3/23 13:22

  • marijun

  • Just popping in

  • Posts: 53

  • Since: 2004/6/4 1


now that the browser crashing/select hovering has been solved...of course, i run into a new problem :)

i know i'm doing something immensely stupid wrong. i've been poring over this code and tinkering with it for 2 days now and i can't seem to get it to work properly. here's the problem.

i have this form that adds and edits calendar events. the form and the functions that populate it are called from admin/index.php, and a class does a lot of the work too. this form works fine for adding events, i'm led to believe the form isn't the problem. i added some debug code that prints all the variables sent by the form and they are correct when adding or editing. when editing an event, however, its not processed correctly somewhere and the edited event is added as a new event and the unedited event stays the same. in essence, its just cloning the event.

this is my first XOOPS module, and my first big php project...so go easy on me :)

i really need some fresh eyes to look at this. the code is too big to paste here, so i'll just put it in text documents and link to them. you'll see the code looks somewhat familiar, i horked most of it from the news module.

here's the calendar class. this is my prime suspect.
http://www.gravitysquared.com/CalendarEvent.txt

here's the event form. xoopsforms kinda confuse me a bit, so if you see anything hokey in here, please tell me how to do it properly. there's also some extra crud in here i used when i was having trouble with the form. excuse the mess!
http://www.gravitysquared.com/Calendar_form.txt

here's the functions. there's a bunch of crap in here that isn't being used yet, the stuff you'd need to look at is towards the bottom.
http://www.gravitysquared.com/Calendar_functions.txt

here's the index.
http://www.gravitysquared.com/Calendar_index.txt

if anyone's willing to help, let me know and i'll PM you with a link to my dev site and an admin login.

please help, this is driving me nuts >_<

2
marijun
Re: i need some fresh eyes and/or a guru :)
  • 2005/3/23 13:25

  • marijun

  • Just popping in

  • Posts: 53

  • Since: 2004/6/4 1


oops, forgot to mention...php debug returns no errors, and the server returns no php error logs either.

3
Mithrandir
Re: i need some fresh eyes and/or a guru :)

function saveEvent() {
    global 
$xoopsModule$xoopsModuleConfig$xoopsUser$HTTP_POST_FILES;
    if (isset(
$eid) && $eid 0) {
        
$ce = new CalendarEvent($eid);
    } else {
        
$ce = new CalendarEvent();
    }
[...]

$eid is never set at that point as you are in a function scope.

4
marijun
Re: i need some fresh eyes and/or a guru :)
  • 2005/3/23 13:47

  • marijun

  • Just popping in

  • Posts: 53

  • Since: 2004/6/4 1


hmm. $eid is supposed to be passed from the form if it is set (ie: in edit mode, which is called by index.php?op=edit&eid=whatevereventid). without that code you pasted, php debug gave me an error saying $eid wasn't set.

how can i make sure $eid is set and passed to the save function properly, and make the save function still add new events properly?

5
bitkid
Re: i need some fresh eyes and/or a guru :)
  • 2005/3/23 13:53

  • bitkid

  • Just popping in

  • Posts: 4

  • Since: 2003/9/12


You need to pass it to the function like this:

function saveEvent($eid = null) {

then inside the function check if it set to something else than null like this:

if (eid != null) {

last you need to send $eid to the saveEvent function when you have it. Something like this:

isset($_POST['eid'])?saveEvent(intval($_POST['eid'])):saveEvent();

Something like that :)

6
marijun
Re: i need some fresh eyes and/or a guru :)
  • 2005/3/23 17:40

  • marijun

  • Just popping in

  • Posts: 53

  • Since: 2004/6/4 1


thanks a million! that's just what i needed.

you wanna know what's tragically funny though?

it still didn't work. not until after i noticed a !$%#*& typo in my sql query.

>_<

i'll have a good laugh at this later when i'm done bashing my head on the wall.

7
Mithrandir
Re: i need some fresh eyes and/or a guru :)

On my test installation I have added
<{php}>
 
$GLOBALS['xoopsLogger']->dumpAll();
<{/
php}>

to a theme and the system_redirect template as well as the $GLOBALS['xoopsLogger']->dumpAll(); to the xoops_cp_footer function. I have also removed some of the code setting the error reporting level so it is always on.
That way I have all the queries and all PHP errors listed - and if I turn on smarty debug, I also have the Smarty popup window - to flush out these problems.

I'll see what I can do about improved debugging (such as enabling multiple debug levels at once) in future XOOPS versions

Login

Who's Online

300 user(s) are online (251 user(s) are browsing Support Forums)


Members: 0


Guests: 300


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits