I have a view that lists schedules.
in this view, each time list has a delivery field ... I have a DeliverableController that has a "DropdownList" action that calls the model and gets a list of results and pushes them to the delivery view (which just creates a drop-down list).
When I get hung up on my schedules, I would like to get a DeliverableController / DropdownList response and put it where my delivery field should be on the schedule.
- A) there is a way to get the controller response from the view
- B) is there a way to get the controller response from the controller method so that I can push the result to the view?
My code so far:
DeliverableController:
class DeliverableController extends BaseController {
private $deliverableRepository;
function __Construct( IDeliverableRepository $deliverableRepo )
{
$this->deliverableRepository = $deliverableRepo;
}
...
public function DropdownList()
{
$deliverables = $this->deliverableRepository->Deliverables();
return View::make( 'Deliverable/_DropdownList', array( "Model" => $deliverables ) );
}
}
End Results / _DropdownList View:
<?php
foreach( $Model as $item )
{
?>
<select name="">
<option value = "<?php echo $item->ID; ?>"><?php echo $item->Title; ?></option>
</select>
<?php
}
?>
Schedule Controller:
class TimesheetController extends BaseController {
private $timesheetRepository;
function __Construct( ITimesheetRepository $timesheetRepo )
{
$this->timesheetRepository = $timesheetRepo;
}
...
public function GetCreate()
{
return View::make( 'Timesheet/Create' );
}
public function PostCreate()
{
}
}
Timesheet / Create
@extends( 'layout' )
@section( 'Styles' )
<link href="<?php echo Request::root(); ?>/Styles/Timesheet.css" rel="stylesheet">
@stop
@section( 'Title' )
Create timesheets
@stop
@section( 'Content' )
<form role="form">
<table id="TimesheetTable" class="table">
<thead>
<tr>
<th>Project/Deliverable</th>
...
</tr>
</thead>
<tfoot>
<tr>
<td></td>
...
</tr>
</tfoot>
<tbody>
<?php
for( $a = 0; $a < 18; $a++ )
{
?>
<tr id='row<?php echo $a; ?>'>
<td><?php ?></td>...
</tr>
<?php
}
?>
</tbody>
</table>
@stop
@section( 'Scripts' )
<script src="<?php echo Request::root(); ?>/Scripts/Timesheet.js"></script>
@stop
Pay attention to the answer / * Get from DeliverableController / DropdownList * /
source
share