public function attributeLabels()
 {
     $labels = array('id' => Yum::t('Profile ID'), 'user_id' => Yum::t('User ID'));
     foreach (YumProfile::getProfileFields() as $field) {
         $labels[$field] = Yum::t($field);
     }
     return $labels;
 }
Пример #2
0
    $attributes = array('id');
    if (!Yum::module()->loginType & UserModule::LOGIN_BY_EMAIL) {
        $attributes[] = 'username';
    }
    if ($profiles && $model->profile) {
        foreach (YumProfile::getProfileFields() as $field) {
            array_push($attributes, array('label' => Yum::t($field), 'type' => 'raw', 'value' => $model->profile->getAttribute($field)));
        }
    }
    array_push($attributes, array('name' => 'createtime', 'value' => date(UserModule::$dateFormat, $model->createtime)), array('name' => 'lastvisit', 'value' => date(UserModule::$dateFormat, $model->lastvisit)), array('name' => 'lastpasswordchange', 'value' => date(UserModule::$dateFormat, $model->lastpasswordchange)), array('name' => 'superuser', 'value' => YumUser::itemAlias("AdminStatus", $model->superuser)), array('name' => Yum::t('Activation link'), 'value' => $model->getActivationUrl()), array('name' => 'status', 'value' => YumUser::itemAlias("UserStatus", $model->status)));
    $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => $attributes));
} else {
    // For all users
    $attributes = array('username');
    if ($profiles) {
        $profileFields = YumProfile::getProfileFields();
        if ($profileFields) {
            foreach ($profileFields as $field) {
                array_push($attributes, array('label' => Yum::t($field), 'name' => $field, 'value' => $model->profile->getAttribute($field)));
            }
        }
    }
    array_push($attributes, array('name' => 'createtime', 'value' => date(UserModule::$dateFormat, $model->createtime)), array('name' => 'lastvisit', 'value' => date(UserModule::$dateFormat, $model->lastvisit)));
    $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => $attributes));
}
if (Yum::hasModule('role') && Yii::app()->user->isAdmin()) {
    Yii::import('user.role.models.*');
    echo '<h2>' . Yum::t('This user belongs to these roles:') . '</h2>';
    if ($model->roles) {
        echo "<ul>";
        foreach ($model->roles as $role) {
 public function actionSelect()
 {
     $profile = new YumProfile();
     $this->render('select', array('user' => new YumUser(), 'profile_fields' => $profile->getProfileFields()));
 }
Пример #4
0
 public function search()
 {
     $criteria = new CDbCriteria();
     $sort = new CSort();
     if (Yum::hasModule('profile') && $this->profile) {
         $criteria->with = array('profile');
         $criteria->together = false;
         foreach (YumProfile::getProfileFields() as $column) {
             if ($this->profile->{$column}) {
                 $criteria->compare('profile.' . $column, $this->profile->{$column}, true);
             }
             $sort->attributes['profile.' . $column] = array('asc' => 'profile.' . $column, 'desc' => 'profile.' . $column . ' DESC');
         }
     }
     if (Yum::hasModule('role') && $this->filter_role) {
         $criteria->join = 'left join {{user_role}} user_role on t.id = user_role.user_id';
         $criteria->addCondition('user_role.role_id = ' . $this->filter_role);
     }
     $criteria->compare('t.id', $this->id, true);
     $criteria->compare('t.username', $this->username, true);
     $criteria->compare('t.status', $this->status);
     $criteria->compare('t.superuser', $this->superuser);
     $criteria->compare('t.createtime', $this->createtime, true);
     $criteria->compare('t.lastvisit', $this->lastvisit, true);
     $sort->attributes[] = '*';
     return new CActiveDataProvider(get_class($this), array('criteria' => $criteria, 'sort' => $sort, 'pagination' => array('pageSize' => Yum::module()->pageSize)));
 }
Пример #5
0
Yum::requiredFieldNote();
?>
</p>

<?php 
$form = $this->beginWidget('CActiveForm', array('id' => 'privacysetting-form', 'enableAjaxValidation' => true));
echo $form->errorSummary($model);
?>

<div class="profile_field_selection">
<?php 
echo '<h3>' . Yum::t('Profile field public options') . '</h3>';
echo '<p>' . Yum::t('Select the fields that should be public') . ':</p>';
$i = 1;
$counter = 0;
foreach (YumProfile::getProfileFields() as $field) {
    $counter++;
    if ($counter == 1) {
        echo '<div class="float-left" style="width: 175px;">';
    }
    printf('<div>%s<label class="profilefieldlabel" for="privacy_for_field_%d">%s</label></div>', CHtml::checkBox("privacy_for_field_{$i}", $model->public_profile_fields & $i), $i, Yum::t($field));
    $i *= 2;
    if ($counter % 4 == 0) {
        echo '</div><div class="float-left" style="width: 175px;">';
    }
}
if ($counter % 4 != 0) {
    echo '</div>';
}
echo '<div class="clear"></div>';
?>
Пример #6
0
<?php

$columns = YumProfile::getProfileFields();
$this->widget('zii.widgets.grid.CGridView', array('id' => 'profiles-grid', 'dataProvider' => $dataProvider, 'filter' => null, 'columns' => $columns));
?>