Ejemplo n.º 1
0
	<?php 
echo $form->field($model, 'action')->widget(Select2::className(), ['data' => $model->setting('actions'), 'theme' => Select2::THEME_KRAJEE, 'options' => ['id' => 'alert-action' . $uniqid, 'placeholder' => 'Alert me...', "allowClear" => true]])->label("Action");
?>
    
	<?php 
echo $form->field($model, 'remote_type')->widget(DepDrop::className(), ['value' => $model->remote_type, 'data' => [$model->remote_type => $model->properName($model->remote_type)], 'options' => ['placeholder' => ' select something ', 'id' => 'alert-type' . $uniqid], 'type' => DepDrop::TYPE_SELECT2, 'select2Options' => ['id' => 'alert-remote-type' . $uniqid, 'pluginOptions' => ['allowClear' => true]], 'pluginOptions' => ['depends' => ['alert-action' . $uniqid], 'url' => Url::to(['/alerts/list/types']), 'loadingText' => '...', 'placeholder' => ' type of ']])->label("Remote Type");
?>
    
	<?php 
echo $form->field($model, 'remote_for')->widget(DepDrop::className(), ['value' => $model->remote_for, 'data' => [$model->remote_for => $model->properName($model->remote_for)], 'options' => ['placeholder' => ' for ', 'id' => 'alert-for' . $uniqid], 'type' => DepDrop::TYPE_SELECT2, 'select2Options' => ['id' => 'alert-remote-type' . $uniqid, 'pluginOptions' => ['allowClear' => true]], 'pluginOptions' => ['depends' => ['alert-type' . $uniqid], 'url' => Url::to(['/alerts/list/for']), 'loadingText' => '...', 'placeholder' => ' and it\'s for a/an ']])->label("Remote For");
?>
	<?php 
echo $form->field($model, 'priority')->widget(DepDrop::className(), ['value' => $model->priority, 'data' => [$model->priority => $model->properName($model->priority)], 'options' => ['placeholder' => ' and it if has a priority of ', 'id' => 'priority' . $uniqid], 'type' => DepDrop::TYPE_SELECT2, 'select2Options' => ['id' => 'alert-priority' . $uniqid, 'pluginOptions' => ['allowClear' => true]], 'pluginOptions' => ['depends' => ['alert-type' . $uniqid], 'url' => Url::to(['/alerts/list/priority']), 'loadingText' => '...', 'placeholder' => ' and has a proiority of ']])->label("Priority");
?>
	<?php 
echo $form->field($model, 'methods')->widget(Select2::className(), ['value' => explode(',', $model->methods), 'options' => ['id' => 'alert-methods' . $uniqid, 'placeholder' => ' then alert me using'], 'data' => \nitm\helpers\alerts\DispatcherData::supportedMethods()])->label("Priority");
?>
	
		
	<?php 
if (!\Yii::$app->request->isAjax) {
    ?>
	<div class="btn-group">
		<?php 
    echo Html::submitButton(ucfirst($action), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
    ?>
	</div>
	<?php 
}
?>
	
Ejemplo n.º 2
0
 protected function initializeMethods()
 {
     $this->followMethods = array_merge($this->_defaultFollowMethods, $this->followMethods);
     $supported = \nitm\helpers\alerts\DispatcherData::supportedMethods();
     foreach ($this->followMethods as $idx => $method) {
         switch (isset($supported[$method['method']])) {
             case true:
                 $method['label'] = Icon::show($method['icon']) . ' ' . $method['label'];
                 $method['url'] = '/alerts/follow/' . $this->model->remote_type . '/' . $this->model->remote_id . '/' . $method['method'];
                 $method['linkOptions'] = ['role' => 'dynamicValue', 'data-pjax' => 0, 'data-run-once' => true, 'data-type' => 'callback', 'data-ajax-method' => 'post', 'data-id' => '#' . $this->options['id'], 'data-callback' => "function (result, elem) { \$nitm.module('follow').afterAction(result, elem);}"];
                 $this->followMethods[$idx] = $method;
                 break;
             default:
                 unset($this->followMethods[$idx]);
                 break;
         }
     }
 }