Jump to content

Side Bar Help


Recommended Posts

Guest lorathon
Posted

I am trying to get a template to display in the side bar. But all I get is the name of the template being displayed. If I change the name of the template to one of the existing ones that sidebar shows up. (sidebar_aircraft.tpl - will display the aircraft template in the side bar)


public function HTMLHead()
{
	$this->set('sidebar', 'sidebar_events.tpl');
}	

This is at the being of the module. Do I need to reference this somewhere? I have searched everywhere and just can't figure it out.

Thanks

Guest lorathon
Posted

I am trying to write a new module for airline events. This is at the top of the new module.

/admin/modules/eventsAdmin/eventsAdmin.php

Guest lorathon
Posted

I know that my code is wrong as it messes up the export schedule function. So I have removed the sidebar code.

Guest lorathon
Posted

Nevermind the whole thing is FUBAR anyways. Back to the drawing board. I appreciate the help.

But here was the code anyways. It completely messed up the export schedule function. I was trying to make a module for airline events and then incorporate into the admin panel. Everything worked except I could not get the sidebar template to display and it also screws up the export even with the sidebar reference removed. I must have missed something. Would it be better to add this to the operations module?

class EventAdmin extends CodonModule
{

public function HTMLHead()
{
	$this->set('sidebar', 'sidebar_events.tpl');
}	


public function events()
{
	if(isset($this->post->action))
	{
		switch($this->post->action)
		{
			case 'addevent':
				$this->add_event_post();
				break;				
			case 'editevent':
				$this->edit_event_post();
				break;				
			case 'deleteevent':
				$ret = EventData::DeleteEvent($this->post->id);
				LogData::addLog(Auth::$userinfo->pilotid, 'Deleted an event');
				break;
		}
	}

	$this->set('events', EventData::get_EventDataAll());
	$this->render('events_allevents.tpl');
}

public function addevent()
{

	$this->set('title', 'Add Event');
	$this->set('action', 'addevent');

	$this->render('events_eventform.tpl');

}

protected function add_event_post()
{
	if($this->post->name == '' || $this->post->date == '' || $this->post->flightnum == ''|| $this->post->starttime == '')
	{
		$this->set('message', 'The name, date start time and Flight Number must be entered');
		$this->render('core_error.tpl');
		return;
	}

	$ret = EventData::AddEvent($this->post->eventid, $this->post->name, $this->post->descrip, 
			$this->post->date, $this->post->flightnum, $this->post->starttime, $this->post->enabled);


	$this->set('message', 'Event Added!');
	$this->render('core_success.tpl');

	LogData::addLog(Auth::$userinfo->pilotid, "Added the event \"{$this->post->name}\"");
}


public function editevent()
{
	$this->set('title', 'Edit Event');
	$this->set('action', 'editevent');
	$this->set('event', EventData::get_EventData($this->get->eventid));

	echo $title;
	echo $action;
	echo $event->name;

	$this->render('events_eventform.tpl');

}

protected function edit_event_post()
{		
	if($this->post->name == '' || $this->post->date == '' || $this->post->flightnum == ''|| $this->post->starttime == '')
	{
		$this->set('message', 'The name, date start time and Flight Number must be entered');
		$this->render('core_error.tpl');
		return;
	}

	$ret = EventData::EditEvent($this->post->eventid, $this->post->name, $this->post->descrip, 
			$this->post->date, $this->post->flightnum, $this->post->starttime, $this->post->enabled);

	$this->set('message', 'Event Added!');
	$this->render('core_success.tpl');

	LogData::addLog(Auth::$userinfo->pilotid, 'Edited the event "'.$this->post->name.'"');
}

}

Guest lorathon
Posted

I guess my question should be.....

If I want to create an Event module and be able to add/edit/delete airline events what is the best way to incorporate it into phpVMS. I basically tried to duplicate the Awards module. When I stuff my module in I would get header errors declared when trying to export the schedule. I cant remember the exact error but it stated that the event module had already sent the header information.

  • Administrators
Posted

I guess my question should be.....

If I want to create an Event module and be able to add/edit/delete airline events what is the best way to incorporate it into phpVMS. I basically tried to duplicate the Awards module. When I stuff my module in I would get header errors declared when trying to export the schedule. I cant remember the exact error but it stated that the event module had already sent the header information.

What you're doing is correct. Create your own module and data, that way it stays clean.

OH! Headers already sent - that means in your module or eventsdata class, there's some whitespace outside of the PHP tags which it's outputting. I always leave out the ending PHP tag at the end of a file, so there won't be any accidental output of whitespace.

Guest lorathon
Posted

Thanks very much. The whitespace was the problem.

So if I am doing it correctly how do I get the sidebar to display? When I use the code this is what I get. Is there a reference somewhere that I am missing?

post-451-12676279332521_thumb.jpg

  • Administrators
Posted

Thanks very much. The whitespace was the problem.

So if I am doing it correctly how do I get the sidebar to display? When I use the code this is what I get. Is there a reference somewhere that I am missing?

What's in your sidebar_events.tpl file? It seems like you're doing it correctly. Does that file exist? It should be in admin/templates

Guest lorathon
Posted

This is the code for the sidebar_events.tpl

<h3>Tasks</h3>
<ul class="filetree treeview-famfamfam">
<li><span class="file">
	<a id="dialog" class="jqModal" href="<?php echo SITE_URL?>/admin/action.php/eventadmin/addevent">Add Event</a>
</span></li>
</ul>
<h3>Help</h3>
<p>Add, Edit, or Delete Airline Events</p>

I copied the Awards template and only changed a few items inside.

And yes it is located /admin/templates

  • Administrators
Posted

This is the code for the sidebar_events.tpl

<h3>Tasks</h3>
<ul class="filetree treeview-famfamfam">
<li><span class="file">
	<a id="dialog" class="jqModal" href="<?php echo SITE_URL?>/admin/action.php/eventadmin/addevent">Add Event</a>
</span></li>
</ul>
<h3>Help</h3>
<p>Add, Edit, or Delete Airline Events</p>

I copied the Awards template and only changed a few items inside.

And yes it is located /admin/templates

If you try displaying a different sidebar, does it work?

Guest lorathon
Posted

If you try displaying a different sidebar, does it work?

Yes, if I just change the name of the reference to "sidebar_airlines.tpl" the airlines sidebar will display properly.

  • Administrators
Posted

Yes, if I just change the name of the reference to "sidebar_airlines.tpl" the airlines sidebar will display properly.

Ok, let's check permissions on your sidebar file, are they 775? Maybe it doesn't have read permissions from the web user. Also, maybe try renaming it to just "test.tpl" and see if that works.

Guest lorathon
Posted

Thank you. I am so sorry for wasting your time. It seems that the file was named sidebar_event.tpl not sidebar_events.tpl. I thought I checked this but I must have just assumed that I had. I feel like a complete idiot. I figured it out when changing the name of the file. It just jumped right out at me then.

Sorry.

  • Administrators
Posted

Thank you. I am so sorry for wasting your time. It seems that the file was named sidebar_event.tpl not sidebar_events.tpl. I thought I checked this but I must have just assumed that I had. I feel like a complete idiot. I figured it out when changing the name of the file. It just jumped right out at me then.

Sorry.

Hey no prob, I can't even count how many times that's happened to me :D

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...