Example #1
0
 /**
  * Displays a particular model.
  */
 public function actionView()
 {
     $model = $this->loadModel();
     $attributes = array('id', 'username');
     $profileFields = ProfileField::model()->forOwner()->sort()->findAll();
     if ($profileFields) {
         foreach ($profileFields as $field) {
             array_push($attributes, array('label' => UserModule::t($field->title), 'name' => $field->varname, 'type' => 'raw', 'value' => $field->widgetView($model->profile) ? $field->widgetView($model->profile) : ($field->range ? Profile::range($field->range, $model->profile->getAttribute($field->varname)) : $model->profile->getAttribute($field->varname))));
         }
     }
     array_push($attributes, 'password', 'email', 'activkey', array('name' => 'createtime', 'value' => date("d.m.Y H:i:s", $model->createtime)), array('name' => 'lastvisit', 'value' => $model->lastvisit ? date("d.m.Y H:i:s", $model->lastvisit) : UserModule::t("Not visited")), array('name' => 'superuser', 'value' => User::itemAlias("AdminStatus", $model->superuser)), array('name' => 'status', 'value' => User::itemAlias("UserStatus", $model->status)));
     $this->render('view', array('model' => $model, 'attributes' => $attributes));
 }
Example #2
0
<?php

$this->breadcrumbs = array(UserModule::t('Users') => array('/user/admin'), $model->username);
?>
<h1><?php 
echo UserModule::t('View User') . ' "' . $model->username . '"';
?>
</h1>

<?php 
echo $this->renderPartial('_menu', array('list' => array(CHtml::link(UserModule::t('Create User'), array('create')), CHtml::link(UserModule::t('Update User'), array('update', 'id' => $model->id)), CHtml::linkButton(UserModule::t('Delete User'), array('submit' => array('delete', 'id' => $model->id), 'confirm' => UserModule::t('Are you sure to delete this item?'))))));
$attributes = array('id', 'username');
$profileFields = ProfileField::model()->forOwner()->sort()->findAll();
if ($profileFields) {
    foreach ($profileFields as $field) {
        array_push($attributes, array('label' => UserModule::t($field->title), 'name' => $field->varname, 'type' => 'raw', 'value' => $field->widgetView($model->profile) ? $field->widgetView($model->profile) : ($field->range ? Profile::range($field->range, $model->profile->getAttribute($field->varname)) : $model->profile->getAttribute($field->varname))));
    }
}
array_push($attributes, 'password', 'email', 'activkey', array('name' => 'createtime', 'value' => date("d.m.Y H:i:s", $model->createtime)), array('name' => 'lastvisit', 'value' => $model->lastvisit ? date("d.m.Y H:i:s", $model->lastvisit) : UserModule::t("Not visited")), array('name' => 'superuser', 'value' => User::itemAlias("AdminStatus", $model->superuser)), array('name' => 'status', 'value' => User::itemAlias("UserStatus", $model->status)));
$this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => $attributes));
Example #3
0
		</div>
		<div class="right">
		<?if ($field->widgetEdit($profile)) {
			echo $field->widgetEdit($profile);
		} elseif ($field->field_type=="DATE") {
			$this->widget('zii.widgets.jui.CJuiDatePicker', array(
			    'attribute'=>$field->varname,
			    'model'=>$profile,
				'language'=>Yii::app()->language,
                'options'=>array(
					'changeYear'=>true,
					'yearRange'=>'-50:-15',
					'dateFormat'=>'yy-mm-dd',
				),
				'htmlOptions'=>array('size'=>30,'class'=>'date')
			));		
		} elseif ($field->range) {
			echo $form->dropDownList($profile,$field->varname,Profile::range($field->range));
		} elseif ($field->field_type=="TEXT") {
			echo $form->textArea($profile,$field->varname,array('rows'=>6, 'cols'=>50));
		} else {
			echo $form->textField($profile,$field->varname,array('size'=>60,'maxlength'=>(($field->field_size)?$field->field_size:255)));
		}
		echo $form->error($profile,$field->varname); ?>
		</div>
	</div>	
			<?php
			}
		}
?>
Example #4
0
?>
</td>
</tr>
<?php 
$profileFields = ProfileField::model()->forOwner()->sort()->findAll();
if ($profileFields) {
    foreach ($profileFields as $field) {
        //echo "<pre>"; print_r($profile); die();
        ?>
<tr>
	<th class="label"><?php 
        echo CHtml::encode(UserModule::t($field->title));
        ?>
</th>
    <td><?php 
        echo $field->widgetView($profile) ? $field->widgetView($profile) : CHtml::encode($field->range ? Profile::range($field->range, $profile->getAttribute($field->varname)) : $profile->getAttribute($field->varname));
        ?>
</td>
</tr>
			<?php 
    }
    //$profile->getAttribute($field->varname)
}
?>
<tr>
	<th class="label"><?php 
echo CHtml::encode($model->getAttributeLabel('email'));
?>
</th>
    <td><?php 
echo CHtml::encode($model->email);
Example #5
0
			<?php 
            echo $form->error($profile, $field->varname);
            ?>
			</div>
			<br/>
			<?php 
        } else {
            ?>
			
			<div class="row">
					<strong><?php 
            echo TbHtml::encode(UserModule::t($field->title));
            ?>
:</strong>
					<?php 
            echo TbHtml::encode($field->widgetView($model->profile) ? $field->widgetView($model->profile) : ($field->range ? Profile::range($field->range, $model->profile->getAttribute($field->varname)) : $model->profile->getAttribute($field->varname)));
            ?>
			</div>
			<br/>
		<?php 
        }
    }
}
?>
	<div class="row buttons">
		<?php 
echo TbHtml::button(UserModule::t('Save'), array('color' => TbHtml::BUTTON_COLOR_SUCCESS, 'submit' => ''));
?>
		<?php 
echo TbHtml::linkButton(UserModule::t('Cancel'), array('color' => TbHtml::BUTTON_COLOR_DANGER, 'url' => Yii::app()->request->getUrlReferrer()));
?>
Example #6
0
echo CHtml::errorSummary($model);
echo CHtml::errorSummary($profile);
?>

<?php 
$profileFields = $profile->getFields();
if ($profileFields) {
    foreach ($profileFields as $field) {
        ?>
	<div class="row">
		<?php 
        echo CHtml::activeLabelEx($profile, $field->varname);
        if ($field->widgetEdit($profile)) {
            echo $field->widgetEdit($profile);
        } elseif ($field->range) {
            echo CHtml::activeDropDownList($profile, $field->varname, Profile::range($field->range));
        } elseif ($field->field_type == "TEXT") {
            echo CHtml::activeTextArea($profile, $field->varname, array('rows' => 6, 'cols' => 50));
        } else {
            echo CHtml::activeTextField($profile, $field->varname, array('size' => 60, 'maxlength' => $field->field_size ? $field->field_size : 255));
        }
        echo CHtml::error($profile, $field->varname);
        ?>
	</div>	
			<?php 
    }
}
?>
	<div class="row">
		<?php 
echo CHtml::activeLabelEx($model, 'username');
Example #7
0
	
	<?php 
$profileFields = $profile->getFields();
if ($profileFields) {
    foreach ($profileFields as $field) {
        if ($field->widgetEdit($profile)) {
            echo '<div class="form-group">';
            echo '<label class="control-label col-md-3">';
            echo $form->labelEx($profile, $field->varname);
            echo '</label>';
            echo '<div class="col-md-9">';
            echo $field->widgetEdit($profile, array('class' => 'form-control'));
            echo '</div>';
            echo '</div>';
        } elseif ($field->range) {
            echo $form->dropDownListGroup($profile, $field->varname, array('wrapperHtmlOptions' => array(), 'widgetOptions' => array('data' => Profile::range($field->range), 'htmlOptions' => array())));
        } elseif ($field->field_type == "TEXT") {
            echo $form->textAreaGroup($profile, $field->varname, array('wrapperHtmlOptions' => array(), 'widgetOptions' => array('htmlOptions' => array('rows' => 5))));
        } else {
            echo $form->textFieldGroup($profile, $field->varname, array('widgetOptions' => array('htmlOptions' => array('size' => 60, 'maxlength' => $field->field_size ? $field->field_size : 255))));
        }
    }
}
echo $form->textFieldGroup($model, 'username', array('widgetOptions' => array('htmlOptions' => array('size' => 60, 'maxlength' => $field->field_size ? $field->field_size : 255))));
echo $form->error($model, 'username');
echo $form->textFieldGroup($model, 'email', array('widgetOptions' => array('htmlOptions' => array('size' => 60, 'maxlength' => $field->field_size ? $field->field_size : 255))));
echo $form->error($model, 'email');
?>
	<div class="form-actions text-right">
	<?php 
$this->widget('booster.widgets.TbButton', array('buttonType' => 'submit', 'context' => 'primary', 'label' => 'Save'));
Example #8
0
function lomake($profile, $field, $form)
{
    /* lomake */
    if ($field->varname == 'alennus_loppu_pvm') {
        echo '<div class="form-inline">' . $form->labelEx($profile, $field->varname, array('class' => 'form-group')) . ' 
		<i class="fa fa-question-circle form-group text-success" data-toggle="tooltip" title="Jos haluat myydä käyttöaikaa alennuksella, niin määritä tässä alennuksen lopetuspäivämäärä."></i>
		</div>';
    } elseif ($field->varname == 'alennus_prosentti') {
        echo '<div class="form-inline">' . $form->labelEx($profile, $field->varname, array('class' => 'form-group')) . ' 
		<i class="fa fa-question-circle form-group text-success" data-toggle="tooltip" title="Jos haluat myydä käyttöaikaa alennuksella, niin määritä tässä alennusprosentti."></i>
		</div>';
    } else {
        echo $form->labelEx($profile, $field->varname);
    }
    if ($widgetEdit = $field->widgetEdit($profile)) {
        echo $widgetEdit;
    } elseif ($field->range) {
        echo $form->dropDownList($profile, $field->varname, Profile::range($field->range), array('class' => 'form-control'));
    } elseif ($field->varname == "alennus_loppu_pvm") {
        echo $form->textField($profile, $field->varname, array('size' => 60, 'maxlength' => $field->field_size ? $field->field_size : 255, 'class' => 'form-control datepicker'));
    } elseif ($field->field_type == "TEXT") {
        echo $form->textArea($profile, $field->varname, array('rows' => 6, 'cols' => 50, 'class' => 'form-control'));
    } elseif ($field->field_type == "FLOAT") {
        echo $form->numberField($profile, $field->varname, array('class' => 'form-control', 'step' => '0.01'));
    } else {
        echo $form->textField($profile, $field->varname, array('size' => 60, 'maxlength' => $field->field_size ? $field->field_size : 255, 'class' => 'form-control'));
    }
    echo $form->error($profile, $field->varname);
    /* lomake */
}
Example #9
0
$form = $this->beginWidget('UActiveForm', array('id' => 'registration-form', 'enableAjaxValidation' => true, 'disableAjaxValidationAttributes' => array('RegistrationForm_verifyCode'), 'clientOptions' => array('validateOnSubmit' => true), 'htmlOptions' => array('class' => 'form-horizontal form-groups-bordered validate', 'role' => 'form', 'enctype' => 'multipart/form-data')));
$profileFields = $profile->getFields();
if ($profileFields) {
    foreach ($profileFields as $field) {
        ?>
            <div class="form-group">
                <?php 
        echo $form->labelEx($profile, $field->varname, array('class' => 'col-sm-3 control-label'));
        ?>
                <div class="col-sm-5">
                    <?php 
        if ($widgetEdit = $field->widgetEdit($profile)) {
            echo $widgetEdit;
        } elseif ($field->range) {
            echo $form->dropDownList($profile, $field->varname, Profile::range($field->range), array('class' => 'form-control'));
        } elseif ($field->field_type == "TEXT") {
            echo $form->textArea($profile, $field->varname, array('rows' => 6, 'cols' => 50, 'class' => 'form-control'));
        } else {
            echo $form->textField($profile, $field->varname, array('size' => 60, 'maxlength' => $field->field_size ? $field->field_size : 255, 'class' => 'form-control'));
        }
        ?>
                </div>
                <?php 
        echo $form->error($profile, $field->varname);
        ?>
            </div>
            <?php 
    }
}
?>
Example #10
0
    ?>
                    <div style="text-align:center"><h3># 会员注册 #</h3></div>
                    <p class="help-block" style="text-align:center;padding-bottom:10px">请输入您的注册信息:</p>
                    <?php 
    //echo $form->errorSummary(array($model, $profile));
    ?>
                    <?php 
    echo $form->textFieldControlGroup($model, 'username');
    ?>
                    <?php 
    echo $form->passwordFieldControlGroup($model, 'password', array('hint' => UserModule::t("Minimal password length 4 symbols.")));
    ?>

                    <?php 
    echo $form->passwordFieldControlGroup($model, 'verifyPassword');
    ?>
                    <?php 
    echo $form->textFieldControlGroup($model, 'email');
    ?>
                    <?php 
    $profileFields = $profile->getFields();
    if ($profileFields) {
        foreach ($profileFields as $field) {
            if ($field->widgetEdit($profile)) {
                echo $field->widgetEdit($profile);
            } elseif ($field->range) {
                echo $form->dropDownListControlGroup($profile, $field->varname, Profile::range($field->range));
            } elseif ($field->field_type == "TEXT") {
                echo $form->textAreaControlGroup($profile, $field->varname, array('rows' => 6, 'cols' => 50));
            } else {
                echo $form->textFieldControlGroup($profile, $field->varname, array('size' => 60, 'maxlength' => $field->field_size ? $field->field_size : 255));
Example #11
0
$profileFields = $profile->getFields();
if ($profileFields) {
    foreach ($profileFields as $field) {
        ?>
	<div class="row form-group">
        <div class="col-md-3 control-label">
		<?php 
        echo $form->labelEx($profile, $field->varname);
        ?>
        </div>
        <div class="col-md-4">
		<?php 
        if ($widgetEdit = $field->widgetEdit($profile)) {
            echo $widgetEdit;
        } elseif ($field->range) {
            echo $form->dropDownList($profile, $field->varname, Profile::range($field->range), ['class' => 'form-control input-md']);
        } elseif ($field->field_type == "TEXT") {
            echo CHtml::activeTextArea($profile, $field->varname, array('rows' => 6, 'cols' => 50));
        } else {
            echo $form->textField($profile, $field->varname, array('size' => 60, 'maxlength' => $field->field_size ? $field->field_size : 255, 'class' => 'form-control input-md'));
        }
        ?>
		<?php 
        echo $form->error($profile, $field->varname);
        ?>
        </div>
	</div>
			<?php 
    }
}
?>
Example #12
0
	);
	$this->widget('zii.widgets.CDetailView', array(
		'data'=>$model,
		'attributes'=>$attributes
	
	));
	
	$prof_attrs = array();
	$profileFields=ProfileField::model()->forOwner()->sort()->findAll();
	if ($profileFields) {
		foreach($profileFields as $field) {
			array_push($prof_attrs, array(
				'label' => Users::t($field->title),
				'name' => $field->varname,
				'stype'=>'raw',
				'value' => ($field->widgetView($model->profile)?$field->widgetView($model->profile):
										(($field->range)?Profile::range($field->range,$model->profile->getAttribute($field->varname)):
													$model->profile->getAttribute($field->varname))),
			));
		}
	}
	
	echo 'Профиль';
	
	$this->widget('zii.widgets.CDetailView', array(
		'data'=>$model->profile,
		'attributes'=>$prof_attrs,
	));
	
?>
Example #13
0
<?php

use marsoltys\yii2user\models\ProfileField;
use marsoltys\yii2user\Module;
use yii\widgets\DetailView;
$this->params['breadcrumbs'] = [['label' => Module::t('Users'), 'url' => ['index']], $model->username];
Module::getInstance()->setMenu([['label' => Module::t('List User'), 'url' => ['index']]]);
?>
<h1><?php 
echo Module::t('View User') . ' "' . $model->username . '"';
?>
</h1>
<?php 
// For all users
$attributes = ['username'];
$profileFields = ProfileField::find()->forAll()->sort()->all();
if ($profileFields) {
    foreach ($profileFields as $field) {
        array_push($attributes, ['label' => Module::t($field->title), 'attribute' => $field->varname, 'value' => $field->widgetView($model->profile) ? $field->widgetView($model->profile) : ($field->range ? Profile::range($field->range, $model->profile->getAttribute($field->varname)) : $model->profile->getAttribute($field->varname))]);
    }
}
array_push($attributes, 'create_at', ['attribute' => 'lastvisit_at', 'value' => $model->lastvisit_at != '0000-00-00 00:00:00' ? $model->lastvisit_at : Module::t('Not visited')]);
echo DetailView::widget(['model' => $model, 'attributes' => $attributes]);
Example #14
0
<?php
 
    $attributes = array(
        'username',
        'email',
    );
    
    $profileFields=ProfileField::model()->forOwner()->sort()->findAll();
    if ($profileFields) {
        foreach($profileFields as $field) {
            array_push($attributes,array(
                    'label' => UserModule::t($field->title),
                    'name' => $field->varname,
                    'type'=>'raw',
                    'value' => (($field->widgetView($model->profile))?$field->widgetView($model->profile):(($field->range)?Profile::range($field->range,$model->profile->getAttribute($field->varname)):$model->profile->getAttribute($field->varname))),
                ));
        }
    }
    
    array_push($attributes,
        'create_at',
        'lastvisit_at',
        array(
            'name' => 'status',
            'value' => User::itemAlias("UserStatus",$model->status),
        )
    );
    
    $this->widget('bootstrap.widgets.TbDetailView', array(
        'data'=>$model,
Example #15
0
</div>
<?php endif; ?>
<table class="dataGrid">
	<tr>
		<th class="label"><?php echo CHtml::encode($model->getAttributeLabel('username')); ?></th>
	    <td><?php echo CHtml::encode($model->username); ?></td>
	</tr>
	<?php 
		$profileFields=ProfileField::model()->forOwner()->sort()->findAll();
		if ($profileFields) {
			foreach($profileFields as $field) {
				//echo "<pre>"; print_r($profile); die();
			?>
	<tr>
		<th class="label"><?php echo CHtml::encode(UserModule::t($field->title)); ?></th>
    	<td><?php echo (($field->widgetView($profile))?$field->widgetView($profile):CHtml::encode((($field->range)?Profile::range($field->range,$profile->getAttribute($field->varname)):$profile->getAttribute($field->varname)))); ?></td>
	</tr>
			<?php
			}//$profile->getAttribute($field->varname)
		}
	?>
	<tr>
		<th class="label"><?php echo CHtml::encode($model->getAttributeLabel('email')); ?></th>
    	<td><?php echo CHtml::encode($model->email); ?></td>
	</tr>
	<tr>
		<th class="label"><?php echo CHtml::encode($model->getAttributeLabel('create_at')); ?></th>
    	<td><?php echo $model->create_at; ?></td>
	</tr>
	<tr>
		<th class="label"><?php echo CHtml::encode($model->getAttributeLabel('lastvisit_at')); ?></th>
Example #16
0
<?php
 
	$attributes = array(
		'id',
		'username',
	);
	
	$profileFields=ProfileField::model()->forOwner()->sort()->findAll();
	if ($profileFields) {
		foreach($profileFields as $field) {
            $value = $model->profile->getAttribute($field->varname);
			array_push($attributes,array(
					'label' => UserModule::t($field->title),
					'name' => $field->varname,
					'type'=>'raw',
					'value' => (($field->widgetView($model->profile))?$field->widgetView($model->profile):(($field->range)?Profile::range($field->range,$value):(isset($value)?$value:''))),
				));
		}
	}
	
	array_push($attributes,
		'password',
		'email',
		'activkey',
		'create_at',
		'lastvisit_at',
		'previousvisit_at',
		array(
			'name' => 'superuser',
			'value' => User::itemAlias("AdminStatus",$model->superuser),
		),