예제 #1
0
<?php

$create_url = Yii::app()->createAbsoluteUrl('/users/create');
$update_url = Yii::app()->createAbsoluteUrl('/users/update/' . base64_encode($model->user_id));
$form = $this->beginWidget('CActiveForm', array('id' => 'users-form', 'action' => $model->isNewRecord ? $create_url : $update_url, 'enableAjaxValidation' => TRUE, 'enableClientValidation' => TRUE, 'clientOptions' => array('validateOnSubmit' => TRUE, 'validateOnChange' => TRUE), 'htmlOptions' => array('autocomplete' => 'off', 'role' => 'form'), 'focus' => array($model, 'user_name')));
if ($model->isNewRecord) {
    $model->user_password = Utils::getRandomPassword();
}
$list = Department::getDepartmentList();
$typelist = UserRoles::getUserType();
?>
<div class="row">
    <div class="col-md-6">
        <div class="row">
            <div class="col-md-12">
                <div class="form-horizontal">
                    <div class="form-group">
                        <?php 
echo $form->labelEx($model, 'user_name', array('class' => 'col-sm-3 control-label'));
?>
                        <div class="col-sm-9">
                            <?php 
echo $form->textField($model, 'user_name', array('size' => 55, 'maxlength' => 55, 'class' => 'form-control', 'placeholder' => $model->getAttributeLabel('user_name')));
?>
                            <?php 
echo $form->error($model, 'user_name', array('class' => 'text-red'));
?>
                        </div>
                    </div>  
                    <div class="form-group">
                        <?php 
예제 #2
0
                    </div>
                <?php 
}
?>

                <ul id="userTab" class="nav nav-tabs">
                    <li class="active"><a href="#users-list" data-toggle="tab"><i class="fa fa-list"></i> List of Users</a></li>                    
                    <li class=""><a href="#users-add" data-toggle="tab"><i class="fa fa-plus-circle"></i> Add Users</a></li>
                </ul>
                <div id="userTabContent" class="tab-content">                    
                    <div class="tab-pane fade active in" id="users-list">
                        <div class="row">
                            <div class="col-md-12">                                
                                <div class="table-responsive">
                                    <?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'users-grid', 'htmlOptions' => array('class' => 'dataTables_wrapper', 'role' => 'grid'), 'dataProvider' => $model->search(1), 'filter' => $model, 'columns' => array(array('header' => 'S. No.', 'name' => 'S. No.', 'value' => '$this->grid->dataProvider->pagination->currentPage * $this->grid->dataProvider->pagination->pageSize + ($row+1)', 'htmlOptions' => array('style' => 'text-align:center'), 'headerHtmlOptions' => array('style' => 'text-align: center;width:60px')), array('name' => 'user_name', 'value' => '$data->user_name', 'headerHtmlOptions' => array('style' => 'text-align: center;width:220px'), 'htmlOptions' => array('style' => 'text-align:justify;'), 'filter' => CHtml::activeTextField($model, 'user_name', array('placeholder' => $model->getAttributeLabel('user_name'), 'style' => 'font-style:italic', 'autocomplete' => 'off', 'class' => 'form-control'))), array('name' => 'user_email', 'value' => '$data->user_email', 'htmlOptions' => array('style' => 'text-align:justify;-ms-word-break: break-all;word-break: break-all;'), 'filter' => CHtml::activeTextField($model, 'user_email', array('placeholder' => $model->getAttributeLabel('user_email'), 'style' => 'font-style:italic', 'autocomplete' => 'off', 'class' => 'form-control')), 'headerHtmlOptions' => array('style' => 'text-align: center;width:220px')), array('name' => 'phone', 'value' => '$data->phone', 'htmlOptions' => array('style' => 'text-align:justify;-ms-word-break: break-all;word-break: break-all;'), 'filter' => CHtml::activeTextField($model, 'phone', array('placeholder' => $model->getAttributeLabel('phone'), 'style' => 'font-style:italic', 'autocomplete' => 'off', 'class' => 'form-control')), 'headerHtmlOptions' => array('style' => 'text-align: center;width:220px')), array('name' => 'skype', 'value' => '$data->skype', 'htmlOptions' => array('style' => 'text-align:justify;-ms-word-break: break-all;word-break: break-all;'), 'filter' => CHtml::activeTextField($model, 'skype', array('placeholder' => $model->getAttributeLabel('skype'), 'style' => 'font-style:italic', 'autocomplete' => 'off', 'class' => 'form-control')), 'headerHtmlOptions' => array('style' => 'text-align: center;width:220px')), array('header' => 'Tickets', 'value' => 'count(TicketAssign::model()->getTicketbyUser($data->user_id))', 'type' => 'raw', 'headerHtmlOptions' => array('style' => 'text-align: center;width:60px')), array('name' => 'user_department_id', 'value' => 'Department::getDepartmentName($data->user_department_id)', 'htmlOptions' => array('style' => 'text-align:center;'), 'headerHtmlOptions' => array('style' => 'text-align: center;width:120px'), 'filter' => CHtml::activeDropDownList($model, 'user_department_id', Department::getDepartmentList(), array('style' => 'font-style:italic', 'class' => 'form-control', 'empty' => 'Please Select'))), array('name' => 'user_role_type', 'value' => 'UserRoles::getRoleName($data->user_role_type)', 'htmlOptions' => array('style' => 'text-align:center;'), 'headerHtmlOptions' => array('style' => 'text-align: center;width:120px'), 'filter' => CHtml::activeDropDownList($model, 'user_role_type', UserRoles::getUserType(), array('style' => 'font-style:italic', 'class' => 'form-control', 'empty' => 'Please Select'))), array('header' => 'Created By', 'headerHtmlOptions' => array('style' => 'text-align: center;width:130px'), 'value' => 'Users::getUserName($data->user_created_by_id)', 'htmlOptions' => array('style' => 'text-align:justify;')), array('name' => 'user_status', 'type' => 'raw', 'value' => '($data->user_status == 0) ? "<a  class=\\"btn btn-xs btn-red\\" title=\\"Change Status\\" onclick=\\"change_status($data->user_id,1)\\" href=\\"javascript:void(0);\\"><i class=\\"fa fa-minus-square\\"></i></a>" : "<a  class=\\"btn btn-xs btn-green\\" title=\\"Change Status\\" onclick=\\"change_status($data->user_id,0)\\" href=\\"javascript:void(0);\\">Change Status</a>"', 'htmlOptions' => array('style' => 'text-align:center;'), 'headerHtmlOptions' => array('style' => 'text-align: center;width:100px'), 'filter' => CHtml::activeDropDownList($model, 'user_status', array(0 => "Inactive", 1 => 'Active'), array('style' => 'font-style:italic', 'class' => 'form-control', 'empty' => 'Please Select'))), array('header' => 'Action', 'class' => 'CButtonColumn', 'deleteConfirmation' => 'Do you want to delete this User Record?', 'afterDelete' => 'function(link,success,data){ if(success) { $("#statusMsg").css("display", "block"); $("#statusMsg").html(data); $("#statusMsg").animate({opacity: 1.0}, 3000).fadeOut("fast");}}', 'headerHtmlOptions' => array('style' => 'text-align: center;width:60px'), 'htmlOptions' => array('style' => 'text-align:center;'), 'template' => '{update}{viewTicket}', 'buttons' => array('update' => array('label' => '<i class="fa fa-edit"></i>', 'options' => array('title' => 'Update'), 'imageUrl' => FALSE, 'url' => 'Yii::app()->createUrl("users/update", array("id" => base64_encode($data->user_id)))'), 'viewTicket' => array('label' => ' <i class="fa fa-search"></i>', 'options' => array('title' => 'View Ticket'), 'imageUrl' => FALSE, 'url' => 'Yii::app()->createUrl("ticket/index", array("user_id" => base64_encode($data->user_id)))'), 'delete' => array('label' => '<i class="fa fa-times"></i>', 'options' => array('title' => 'Delete', 'class' => 'remove'), 'imageUrl' => FALSE, 'url' => 'Yii::app()->createUrl("users/delete", array("id" => base64_encode($data->user_id)))')))), 'itemsCssClass' => 'table table-striped table-bordered table-hover dataTable', 'pagerCssClass' => 'dataTables_paginate paging_bootstrap', 'summaryCssClass' => 'dataTables_info', 'template' => '{items}<div class = "row"><div class = "col-xs-6">{summary}</div><div class = "col-xs-6">{pager}</div></div>', 'pager' => array('htmlOptions' => array('class' => 'pagination', 'id' => ''), 'header' => '', 'cssFile' => false, 'selectedPageCssClass' => 'active', 'previousPageCssClass' => 'prev', 'nextPageCssClass' => 'next', 'hiddenPageCssClass' => 'disabled', 'maxButtonCount' => 5), 'emptyText' => '<span class="text-danger text-center">No Record Found!</span>'));
?>
                                </div>
                            </div>
                        </div>
                    </div>                   

                    <div class="tab-pane fade" id="users-add">                            
                        <div class="row">
                            <div class="col-md-12">

                                <?php 
$this->renderPartial('_form', array('model' => $model));
?>

                            </div>