Hello,
I think it's a noob question, but I want to learn, so...
I've used the DOM to show a list of schools/organisations which are participating to an action. It works fine to show me a list of schools from a geographic region ('provincie'). In that list I only show some general information (name, address,...) but now I want to 'drill down' on a school (by clicking the name) to get some more details.
Can someone get me the way up? Tanks!
This is my code:
ActionPage.php
<?php
/**
* Defines the ActionPage page type
*/
class ActionPage extends Page {
static $db = array(
);
static $has_many = array(
'Actions' => 'Action'
);
static $allowed_children = array('ActionDetail');
public function getCMSFields () {
$f = parent::getCMSFields();
$f->addFieldToTab("Root.Content.Actions", new DataObjectManager(
$this,
'Actions',
'Action',
array('organisatie' => 'organisatie','roepnaam'=>'roepnaam','voornaam'=>'voornaam','familienaam'=>'familienaam','actief'=>'actief'),
'getCMSFields_forPopup'
));
return $f;
}
}
class ActionPage_Controller extends Page_Controller {
function ListActions() {
if(!isset($_GET['start']) || !is_numeric($_GET['start']) || (int)$_GET['start'] < 1) $_GET['start'] = 0;
$SQL_start = (int)$_GET['start'];
if(!isset($_GET['provincie'])) {
$doSet = DataObject::get(
$callerClass = "Action",
$filter = "`ActionPageID` = '".$this->ID."' AND `Actief` = 1",
$sort = "",
$join = "",
$limit = "{$SQL_start},10"
);
}
else {
$Provincie = $_GET['provincie'];
$doSet = DataObject::get(
$callerClass = "Action",
$filter = "`ActionPageID` = '".$this->ID."' AND `Actief` = 1 AND `provincie` = '$Provincie'",
$sort = "",
$join = "",
$limit = "{$SQL_start},10"
);
}
return $doSet ? $doSet : false;
}
}
?>
ActionPage.ss
$Content
<ul>
<% control ListActions %>
<li>
$organisatie, $roepnaam, $straat $nummer $postbus, $postnummer $gemeente
</li>
<% end_control %>
</ul>
<% if ListActions.MoreThanOnePage %>
<p>
<% if ListActions.PrevLink %>
<a href="$ListActions.PrevLink"><< Vorige</a> |
<% end_if %>
<% control ListActions.Pages %>
<% if CurrentBool %>
<strong>$PageNum</strong>
<% else %>
<a href="$Link" title="Ga naar pagina $PageNum">$PageNum</a>
<% end_if %>
<% end_control %>
<% if ListActions.NextLink %>
| <a href="$ListActions.NextLink">Volgende >></a>
<% end_if %>
</p>
<% end_if %>