Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Writing a config for a plugin
How do i go about writing a config page for the dashboard.
The page needs to read a table and add/update records to that table.
The page needs to read a table and add/update records to that table.
0
Comments
EventArguments['SideMenu']; $Menu->AddItem('GoogleCalendar', 'GoogleCalendar'); $Menu->AddLink('GoogleCalendar', 'Settings', 'plugin/GoogleCalendar','Plugins.GoogleCalendar.Edit'); } public function Controller_Index(&$Sender) { $Sender->AddCssFile('admin.css'); // $SQL = Gdn::Structure(); // $this->$feeds= $SQL // ->Select("url,days,name,feedid") // ->From('Cals') // ->Get(); $Sender->Render($this->GetView('settings.php')); }
and added permission
'RegisterPermissions' => array( 'Plugins.GoogleCalendar.Edit'),
You need a PluginController_GoogleCalendar_Create($Sender) method with this in it:
$this->Dispatch($Sender, $Sender->RequestArgs);
so far ive got:
public function Controller_Edit(&$Sender,$id) { $Sender->AddCssFile('admin.css'); $Sender->AddSideMenu('plugin/googlecalendar'); $validation = new Gdn_Validation(); $calModel = new Gdn_Model('Cals',$validation); $calData = $calModel->GetWhere(array('feedID' => $id))->FirstRow(); $Sender->Form->SetModel($calModel); $Sender->Form->SetData($calData); $Sender->Render($this->GetView('edit.php')); }
and in the view
if (!defined('APPLICATION')) exit(); echo $this->Form->Open(); echo $this->Form->Errors(); echo $this->Form->Label('Feed ID','feedid'); echo $this->Form->Input('feedid'); echo $this->Form->Label('Title','name'); echo $this->Form->Input('name'); echo $this->Form->Label('Days','days'); echo $this->Form->Input('days'); echo $this->Form->Label('Calendar URL','url'); echo $this->Form->Input('url'); echo $this->Form->Close('Save');
Sorry about so many questions but first time ive done this and its simple things i seem to miss.
apart from that the field names are correct.
Do i have to implement a model class?
It's easier to start with too much functionality and whittle down to the part you need than to try and build it from scratch the first time.
My form displays from the view but the content from the model does not.
am i right in using the $id parameter like that?
where the url is domain/plugin/GoogleCalendar/edit/7
where $id = 7.
$id =$Sender->RequestArgs[1];