Skip to content

Commit

Permalink
Dev: question group list, search box, number of rows per page
Browse files Browse the repository at this point in the history
  • Loading branch information
louis committed Sep 18, 2015
1 parent add6afc commit 9851847
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 74 deletions.
5 changes: 5 additions & 0 deletions application/controllers/admin/surveyadmin.php
Expand Up @@ -453,6 +453,11 @@ public function listquestiongroups($surveyid)
$model->attributes = $_GET['QuestionGroup'];
}

if (isset($_GET['pageSize']))
{
Yii::app()->user->setState('pageSize',(int)$_GET['pageSize']);
}

$model['sid'] = $iSurveyID;
$model['language'] = $baselang;
$aData['model']=$model;
Expand Down
4 changes: 3 additions & 1 deletion application/models/QuestionGroup.php
Expand Up @@ -203,6 +203,8 @@ public function getbuttons()

public function search()
{
$pageSize=Yii::app()->user->getState('pageSize',Yii::app()->params['defaultPageSize']);

$sort = new CSort();
$sort->attributes = array(
'Group id'=>array(
Expand Down Expand Up @@ -230,7 +232,7 @@ public function search()
'sort'=>$sort,

'pagination'=>array(
'pageSize'=>10,
'pageSize'=>$pageSize,
),
));
return $dataProvider;
Expand Down
77 changes: 40 additions & 37 deletions application/views/admin/super/header.php
Expand Up @@ -1055,7 +1055,6 @@
/**
* Edit group
*/

#edit-group .tab-pane
{
padding: 1em;
Expand All @@ -1069,73 +1068,79 @@
/**
* Edit question
*/

#edit-question-body
{
min-height: 1200px;
}



/**
* Animations
*/


@keyframes fadein {
@keyframes fadein
{
from { opacity: 0; }
to { opacity: 1; }
}

/* Firefox < 16 */
@-moz-keyframes fadein {
@-moz-keyframes fadein
{
from { opacity: 0; }
to { opacity: 1; }
}

/* Safari, Chrome and Opera > 12.1 */
@-webkit-keyframes fadein {
@-webkit-keyframes fadein
{
from { opacity: 0; }
to { opacity: 1; }
}

/* Internet Explorer */
@-ms-keyframes fadein {
@-ms-keyframes fadein
{
from { opacity: 0; }
to { opacity: 1; }
}

/* Opera < 12.1 */
@-o-keyframes fadein {
@-o-keyframes fadein
{
from { opacity: 0; }
to { opacity: 1; }
}




@keyframes slidefromtop {
@keyframes slidefromtop
{
from { top: -15px;}
to { top: 0px;}
}

/* Firefox < 16 */
@-moz-keyframes slidefromtop {
@-moz-keyframes slidefromtop
{
from { top: -15px;}
to { top: 0px;}
}

@-webkit-keyframes slidefromtop {
@-webkit-keyframes slidefromtop
{
from { top: -15px;}
to { top: 0px;}
}

/* Internet Explorer */
@-ms-keyframes slidefromtop {
@-ms-keyframes slidefromtop
{
from { top: -15px;}
to { top: 0px;}
}

/* Opera < 12.1 */
@-o-keyframes slidefromtop {
@-o-keyframes slidefromtop
{
from { top: -15px;}
to { top: 0px;}
}
Expand All @@ -1150,34 +1155,39 @@
min-height : 80px;
}

@media screen and (min-width: 1280px) and (max-width: 1680px) {
@media screen and (min-width: 1280px) and (max-width: 1680px)
{
#profile-img
{
min-height : 0;
}
}


.login-pannel{
.login-pannel
{
margin-top: 40px;
}

.welcome .login-pannel .panel-body img{
margin-bottom: 0px;
}

.login-title {
.login-title
{
border-bottom : solid 1px #DADADA;
}

.login-content {
.login-content
{

text-align : left;
padding : 1em;
}


.login-submit {
.login-submit
{
border-top : solid 1px #DADADA;
text-align: right;
}
Expand All @@ -1189,13 +1199,15 @@
}


.side-body, .full-page-wrapper{
.side-body, .full-page-wrapper
{
position : relative;
margin-bottom : 65px;
}


.message-box{
.message-box
{
border : 1px solid #89C68D;
color : #2D2D2D;

Expand All @@ -1215,11 +1227,13 @@
}


.panel-clickable:hover{
.panel-clickable:hover
{
cursor: pointer; cursor: hand;
}

.pagination {
.pagination
{
font-size: 1.2em;
}
</style>
Expand All @@ -1233,7 +1247,6 @@


<script>

// MegaMenu
$(document).ready(function(){

Expand Down Expand Up @@ -1451,16 +1464,6 @@


var frameSrc = "/login";

$('#openBtn').click(function(){

});






</script>


Expand Down
111 changes: 75 additions & 36 deletions application/views/admin/super/listquestiongroups.php
@@ -1,64 +1,95 @@
<?php
/**
* This file render the list of groups
*/

/**
* This file render the list of groups
* It use the QuestionGroup model search method to build the data provider.
*
* @var $model obj the QuestionGroup model
* @var $surveyid int
*/
?>

<div class="side-body">
<h3><?php eT('Question Groups in this survey'); ?></h3>
<div class="row">
<div class="col-lg-12 content-right">


<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
'action' => Yii::app()->createUrl('admin/survey/sa/listquestiongroups/surveyid/'.$surveyid),
'method' => 'get',
)); ?>
<div class="row">
<?php echo $form->label($model, 'name'); ?>
<?php echo $form->textField($model, 'group_name'); ?>
</div>
<div class="row buttons">
<?php echo CHtml::submitButton('Search'); ?>
</div>
<?php $this->endWidget(); ?>
</div><!-- form -->



<?php $pageSize=Yii::app()->user->getState('pageSize',Yii::app()->params['defaultPageSize']);?>
<div class="side-body">
<h3><?php eT('Question Groups in this survey'); ?></h3>
<div class="row">
<div class="col-lg-12 content-right">

<!-- Search Box -->
<div class="row">
<div class="col-lg-12">
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
'action' => Yii::app()->createUrl('admin/survey/sa/listquestiongroups/surveyid/'.$surveyid),
'method' => 'get',
'htmlOptions'=>array(
'class'=>'form-horizontal',
),
)); ?>
<div class="form-group">
<?php echo $form->label($model, 'name', array('class'=>'col-sm-2 control-label text-right col-sm-offset-6')); ?>
<div class="col-sm-2 text-right">
<?php echo $form->textField($model, 'group_name', array('class'=>'form-control')); ?>
</div>
<div class="col-sm-2">
<?php echo CHtml::submitButton('Search', array('class'=>'btn btn-success')); ?>
<input type="button" class="btn btn-warning" value="reset" />
</div>
</div>
<?php $this->endWidget(); ?>
</div><!-- form -->
</div>
</div>

<!-- The table grid -->
<div class="row">
<div class="col-lg-12">
<?php
$this->widget('bootstrap.widgets.TbGridView', array(
$this->widget('bootstrap.widgets.TbGridView', array(
'id'=>'question-group-grid',
'dataProvider' => $model->search(),
'columns' => array(

// Number of row per page selection
'summaryText'=>gT('Displaying {start}-{end} of {count} result(s).') .
CHtml::dropDownList(
'pageSize',
$pageSize,
Yii::app()->params['pageSizeOptions'],
array('class'=>'changePageSize form-control', 'style'=>'display: inline; width: auto')) .
gT(' rows per page'),

// Columns to dispplay
'columns' => array(

// Group Id
array(
'name'=>'Group id',
'value'=>'$data->gid',
'htmlOptions' => array('class' => 'col-md-1'),
),


// Group Order
array(
'name'=>'Group Order',
'value'=>'$data->group_order',
'htmlOptions' => array('class' => 'col-md-1'),
),

// Group Name
array(
'name'=>'Group Name',
'value'=>'$data->group_name',
'htmlOptions' => array('class' => 'col-md-2'),
),

// Description
array(
'name'=>'Description',
'type'=>'raw',
'value'=>'$data->description',
'htmlOptions' => array('class' => 'col-md-2'),
),

// Action buttons (defined in model)
array(
'name'=>'',
'type'=>'raw',
Expand All @@ -67,12 +98,20 @@
),

),

'ajaxUpdate' => true,

));
?>
</div>
</div>
</div>

</div>
</div>
</div>
</div>
</div>

<!-- To update rows per page via ajax -->
<script type="text/javascript">
jQuery(function($) {
jQuery(document).on("change", '#pageSize', function(){
$.fn.yiiGridView.update('question-group-grid',{ data:{ pageSize: $(this).val() }});
});
});
</script>

0 comments on commit 9851847

Please sign in to comment.