-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#25 Added 'acknowledge' => true to core forms first step
- Loading branch information
1 parent
68ccf0f
commit 9d18adf
Showing
13 changed files
with
144 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<?php | ||
|
||
/** | ||
* @link https://www.humhub.org/ | ||
* @copyright Copyright (c) 2017 HumHub GmbH & Co. KG | ||
* @license https://www.humhub.com/licences | ||
*/ | ||
|
||
namespace humhub\compat; | ||
|
||
use humhub\modules\ui\form\widgets\ActiveForm; | ||
|
||
/** | ||
* CActiveForm is a Yii 1 compatible active form | ||
* | ||
* @author luke | ||
* @deprecated since 1.4 | ||
*/ | ||
class CAcknowledgeActiveForm extends ActiveForm | ||
{ | ||
public function label($model, $attribute, $htmlOptions = []) | ||
{ | ||
return CHtml::activeLabel($model, $attribute, $htmlOptions); | ||
} | ||
|
||
public function labelEx($model, $attribute, $htmlOptions = []) | ||
{ | ||
return CHtml::activeLabelEx($model, $attribute, $htmlOptions); | ||
} | ||
|
||
public function error($model, $attribute, $htmlOptions = [], $enableAjaxValidation = true, $enableClientValidation = true) | ||
{ | ||
return CHtml::error($model, $attribute, $htmlOptions); | ||
} | ||
|
||
public function passwordField($model, $attribute, $htmlOptions = []) | ||
{ | ||
return CHtml::activePasswordInput($model, $attribute, $htmlOptions); | ||
} | ||
|
||
public function textArea($model, $attribute, $htmlOptions = []) | ||
{ | ||
return CHtml::activeTextarea($model, $attribute, $htmlOptions); | ||
} | ||
|
||
public function checkBox($model, $attribute, $htmlOptions = []) | ||
{ | ||
return CHtml::activeCheckboxNoLabel($model, $attribute, $htmlOptions); | ||
} | ||
|
||
public function dropDownList($model, $attribute, $data, $htmlOptions = []) | ||
{ | ||
return CHtml::activeDropDownList($model, $attribute, $data, $htmlOptions); | ||
} | ||
|
||
public function radioButtonList($model, $attribute, $data, $htmlOptions = []) | ||
{ | ||
return CHtml::activeRadioList($model, $attribute, $data, $htmlOptions); | ||
} | ||
|
||
public function radioButton($model, $attribute, $options = []) | ||
{ | ||
$name = isset($options['name']) ? $options['name'] : CHtml::getInputName($model, $attribute); | ||
$value = CHtml::getAttributeValue($model, $attribute); | ||
|
||
if (!array_key_exists('value', $options)) { | ||
$options['value'] = '1'; | ||
} | ||
|
||
$checked = "$value" === "{$options['value']}"; | ||
|
||
if (!array_key_exists('id', $options)) { | ||
$options['id'] = CHtml::getInputId($model, $attribute); | ||
} | ||
|
||
return CHtml::radio($name, $checked, $options); | ||
} | ||
|
||
public function textField($model, $attribute, $htmlOptions = []) | ||
{ | ||
return CHtml::activeTextField($model, $attribute, $htmlOptions); | ||
} | ||
|
||
public function fileField($model, $attribute, $htmlOptions = []) | ||
{ | ||
return CHtml::activeFileInput($model, $attribute, $htmlOptions); | ||
} | ||
|
||
public function hiddenField($model, $attribute, $htmlOptions = [], $value=null) | ||
{ | ||
if ($value !== null) { | ||
$model->$attribute = $value; | ||
} | ||
|
||
return CHtml::activeHiddenInput($model, $attribute, $htmlOptions); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 15 additions & 12 deletions
27
protected/humhub/modules/notification/views/admin/defaults.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,26 @@ | ||
<?php | ||
use yii\widgets\ActiveForm; | ||
|
||
use humhub\modules\ui\form\widgets\ActiveForm; | ||
|
||
/* @var $model \humhub\modules\notification\models\forms\NotificationSettings */ | ||
?> | ||
|
||
<div class="panel-body"> | ||
<h4><?= Yii::t('AdminModule.settings', 'Notification Settings'); ?></h4> | ||
<div class="help-block"> | ||
<?= Yii::t('NotificationModule.base', 'Notifications are sent directly to your users to inform them about new activities in your network.'); ?><br /> | ||
<?= Yii::t('NotificationModule.base', 'Notifications are sent directly to your users to inform them about new activities in your network.'); ?> | ||
<br/> | ||
<?= Yii::t('NotificationModule.base', 'In this view, you can define the default behavior for your users. These settings can be overwritten by users in their account settings page.'); ?> | ||
<br /> | ||
<br/> | ||
</div> | ||
<?php $form = ActiveForm::begin() ?> | ||
<?= humhub\modules\notification\widgets\NotificationSettingsForm::widget([ | ||
'model' => $model, | ||
'form' => $form, | ||
'showSpaces' => true | ||
]) ?> | ||
<br /> | ||
<button type="submit" class="btn btn-primary" data-ui-loader><?= Yii::t('base', 'Save');?></button> | ||
<?php ActiveForm::end(); ?> | ||
<?php $form = ActiveForm::begin(['acknowledge' => true]) ?> | ||
<?= humhub\modules\notification\widgets\NotificationSettingsForm::widget([ | ||
'model' => $model, | ||
'form' => $form, | ||
'showSpaces' => true | ||
]) ?> | ||
<br/> | ||
<button type="submit" class="btn btn-primary" data-ui-loader><?= Yii::t('base', 'Save'); ?></button> | ||
<?php ActiveForm::end(); ?> | ||
</div> | ||
|