This commit is contained in:
Zachary Doll 2013-11-20 17:21:10 -06:00
parent aefbf84ab0
commit 03e5e07fc8
2 changed files with 34 additions and 18 deletions

View File

@ -59,14 +59,26 @@ class RankController extends DashboardController {
$this->AddSideMenu('rank/settings');
$this->Form->SetModel($this->RankModel);
$this->Title(T('Add Rank'));
$Edit = FALSE;
$Permissions = Gdn::PermissionModel()->GetPermissionsEdit(0);
if($RankID) {
$this->Rank = $this->RankModel->GetRank($RankID);
$this->Form->AddHidden('RankID', $RankID);
$Edit = TRUE;
$this->Title(T('Edit Rank'));
$Permissions = $this->Rank->Permissions;
}
$this->SetData('PermissionData', Gdn::PermissionModel()->GetPermissionsEdit(0), true);
// Load up all permissions
$PermissionModel = new PermissionModel();
$Permissions = $PermissionModel->PermissionColumns();
unset($Permissions['PermissionID']);
$PermissionKeys = array_keys($Permissions);
$PermissionList = array_combine($PermissionKeys, $PermissionKeys);
$this->SetData('Permissions', $PermissionList);
//$this->SetData('PermissionData', $Permissions, true);
if($this->Form->IsPostBack() == FALSE) {
if(property_exists($this, 'Rank')) {
@ -88,6 +100,9 @@ class RankController extends DashboardController {
$this->Form->SetFormValue('Photo', $Parts['SaveName']);
}
decho($this->Form->FormValues());
die();
if($this->Form->Save()) {
if($Edit) {

View File

@ -1,12 +1,7 @@
<?php if(!defined('APPLICATION')) exit();
/* Copyright 2013 Zachary Doll */
if(property_exists($this, 'Rank')) {
echo Wrap(T('Edit Rank'), 'h1');
}
else {
echo Wrap(T('Add Rank'), 'h1');
}
echo Wrap($this->Title(), 'h1');
echo $this->Form->Open(array('enctype' => 'multipart/form-data', 'class' => 'Rank'));
echo $this->Form->Errors();
@ -37,21 +32,27 @@ echo $this->Form->Errors();
echo $this->Form->TextBox('Description');
?>
</li>
<li class="RolePermissions">
<li>
<?php
echo '<strong>'.T('Check all permissions that apply to this role:').'</strong>';
echo $this->Form->CheckBoxGridGroups($this->PermissionData, 'Permission');
echo $this->Form->Label('Permissions', 'Permissions');
echo $this->Form->Dropdown('Permissions', $this->Data('Permissions'), array('multiple' => 'multiple'));
?>
</li>
<!-- <li>
<?php
// echo '<strong>'.T('Check all permissions that apply to this role:').'</strong>';
// echo $this->Form->CheckBoxGridGroups($this->PermissionData, 'Permissions');
?>
</li>-->
<li>
<?php
echo $this->Form->Label('Points Required', 'PointsRequired');
echo $this->Form->TextBox('PointsRequired');
?>
</li>
<li>
<?php
echo $this->Form->Label('Award Value', 'AwardValue');
echo $this->Form->TextBox('AwardValue');
?>
</li>
<li>
<?php
echo $this->Form->Label('Active', 'Enabled');
echo $this->Form->Label('Automatically Award', 'Enabled');
echo $this->Form->CheckBox('Enabled');
?>
</li>