<?php

$this->menu = array(array('label' => ProjectModule::t('Create Project Field'), 'url' => array('create')), array('label' => ProjectModule::t('Update Project Field'), 'url' => array('update', 'id' => $model->id)), array('label' => ProjectModule::t('Delete Project Field'), 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => UserModule::t('Are you sure to delete this item?'))), array('label' => ProjectModule::t('Manage Project Fields'), 'url' => array('admin')));
$this->widget('zii.widgets.CMenu', array('items' => $this->menu, 'htmlOptions' => array('class' => 'operations')));
?>
<h1><?php 
//echo UserModule::t('View Project Field #').$model->varname;
echo UserModule::t('FieldOfOrders') . ' "' . $model->varname . '"';
?>
</h1>

<?php 
$this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('id', 'varname', 'title', 'field_type', 'field_size', 'required', 'error_message', 'default', 'position', 'visible', array('label' => ProjectModule::t('Work types'), 'type' => 'raw', 'value' => $model->work_types == null ? '(' . UserModule::t("All") . ')' : Catalog::getNamesByIds($model->work_types, ', ')))));
</h1>

<?php 
echo CHtml::link(UserModule::t('Edit assignments'), $this->createAbsoluteUrl('/rights/assignment/user', array('id' => $model->id))) . '<br /><br />';
$attributes = array('id', 'username', 'full_name', 'phone_number');
$mailing_list = 0;
if ($model->profile) {
    $profile = ProfileField::model()->findAll();
    if ($profile) {
        foreach ($profile as $field) {
            $arr = 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)));
            if ($field->varname == 'mailing_list') {
                $index = $model->profile->getAttribute($field->varname);
                if ($index > 3) {
                    $index = 0;
                }
                $_temp = array('', 'icq', 'sms', 'email');
                $arr['value'] = $_temp[$index];
            }
            if ($field->field_type == "LIST") {
                $arr['value'] = Catalog::getNamesByIds($model->profile->getAttribute($field->varname), '<br>');
            }
            array_push($attributes, $arr);
        }
    }
}
array_push($attributes, 'password', 'email', 'activkey', 'create_at', 'lastvisit_at', 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));
?>