protected function _index($Sender, $Args)
{
$Sender->setData('Title', t('Pockets'));
// Grab the pockets from the DB.
$PocketData = Gdn::sql()->get('Pocket', 'Location, `Sort`')->resultArray();
// Add notes to the pockets data.
foreach ($PocketData as $Index => &$PocketRow) {
// Add notes for the display.
$Notes = array();
if ($PocketRow['Repeat'] && $PocketRow['Repeat'] != Pocket::REPEAT_ONCE) {
$PocketRow['Location'] .= " ({$PocketRow['Repeat']})";
}
if ($PocketRow['Disabled'] == Pocket::DISABLED) {
$Notes[] = T('Disabled');
} elseif ($PocketRow['Disabled'] == Pocket::TESTING) {
$Notes[] = T('Testing');
}
$PocketRow['Notes'] = implode(', ', $Notes);
}
$Sender->setData('PocketData', $PocketData);
$Form = new Gdn_Form();
// Save global options.
switch (val(0, $Args)) {
case 'showlocations':
saveToConfig('Plugins.Pockets.ShowLocations', true);
break;
case 'hidelocations':
saveToConfig('Plugins.Pockets.ShowLocations', false, array('RemoveEmpty' => true));
break;
}
$Sender->Form = $Form;
$Sender->render('Index', '', 'plugins/Pockets');
}