Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Toggle on a relation field 21 Jul 2017 17:48 #15256

  • VeCrea
  • VeCrea's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100

This browser does not support PDFs. Please download the PDF to view it: Download PDF


Hello,
Happy to be using cook again. Hope you're all having a great time. :silly:
Com_suivi -> Students ->progressionof students
There is a relation field called "progression", which in the table "progressions" is togglable, but is not in the view created within the "students" table (hope i make sense)
Would like this to be togglable too. Tried to add a task in construct in "students" model but no success so far.
A hint ? A solution ? A kiss ? ;-) :evil:
Thanks all

This browser does not support PDFs. Please download the PDF to view it: Download PDF

Attachments:

Please Log in or Create an account to join the conversation.

Toggle on a relation field 24 Jul 2017 16:06 #15258

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Hi VeCrea, Nice to hear from you again !!


You request is a bit complex and cannot be achieved without some manual coding
You did right to create a function in the controller, but in wich controller did you wrote it ?

It should be written in the progression table, and then try to find a way to catch the correct progression ID value for sending to the controller.

The N:1 list should load two values : the ID of the "progression", and the boolean value to display.
With this two informations, you might be able to code it easily.

The task to call may be 'progression.toggle'
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

Toggle on a relation field 24 Jul 2017 18:55 #15259

  • VeCrea
  • VeCrea's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
Well the toggle code is present in the progression controller
public function toggle()
	{
		JSession::checkToken() or JSession::checkToken('get') or jexit(JText::_('JINVALID_TOKEN'));
		$this->_result = $result = $this->_toggle(array(
			'toggle_finished' => 'finished'
		));
		$model = $this->getModel();

		//Define the redirections
		switch($this->getLayout() .'.'. $this->getTask())
		{
			case 'default.toggle':
				$this->applyRedirection($result, array(
					'stay',
					'com_suivi.progressions.default'
				), array(
					'cid[]' => null
				));
				break;

			default:
				$this->applyRedirection($result, array(
					'stay',
					'stay'
				));
				break;
		}
	}
Suppose i should add that code, with adaptations, into the Student controller, as progressionOfStudents is a view of that table. Is it the right path ?
Thanks bro'

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.079 seconds

Awards for the best Joomla app. This product is gonna win an award for this amazing job. Cook Self Service is the the best application from all over the Joomla universe ! It brings Joomla to a professional level really advanced for developers. It is a real fun to develop with it. The ACL part and security checks implementation are just... so much hours saved. I can now concentrate myself more on the design part and the creative works. Thank you so much. Guys I offer you all my congratulation ! Keep up the works because Joomla is needing it to increase the quality of extensions availables on the JED. I also learned a lot because I can see how to code at the proper place and I found all my answers reading the forum.
lack_hanson (JED)
          

Get Started