Skip to content

Commit

Permalink
Dev : dataentry display
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Nov 30, 2015
1 parent a1add9d commit 4c5a875
Show file tree
Hide file tree
Showing 12 changed files with 527 additions and 301 deletions.
62 changes: 30 additions & 32 deletions application/controllers/admin/dataentry.php
Expand Up @@ -78,9 +78,9 @@ function vvimport()
$aData['sidebar']['state'] = "close";
$aData['menu']['edition'] = true;
$aData['menu']['import'] = true;
$aData['menu']['close'] = true;
$aData['menu']['close'] = true;
//

$iSurveyId = sanitize_int(Yii::app()->request->getParam('surveyid'));
$aData['iSurveyId'] = $aData['surveyid'] = $iSurveyId;
if( Permission::model()->hasSurveyPermission($iSurveyId,'responses','create') )
Expand Down Expand Up @@ -297,13 +297,13 @@ public function import($surveyid)
$aData['display']['menu_bars']['browse'] = gT("Quick statistics");

$surveyinfo = Survey::model()->findByPk($iSurveyId)->surveyinfo;
$aData["surveyinfo"] = $surveyinfo;
$aData['title_bar']['title'] = gT('Browse responses').': '.$surveyinfo['surveyls_title'];
$aData["surveyinfo"] = $surveyinfo;
$aData['title_bar']['title'] = gT('Browse responses').': '.$surveyinfo['surveyls_title'];

$aData['sidebar']['state'] = "close";
$aData['menu']['edition'] = true;
$aData['menu']['import'] = true;
$aData['menu']['close'] = true;
$aData['menu']['close'] = true;

$this->_renderWrappedTemplate('dataentry', 'import', $aData);
}
Expand Down Expand Up @@ -490,7 +490,7 @@ public function editdata($subaction, $id, $surveyid, $language='')
$sDataEntryLanguage = Survey::model()->findByPk($surveyid)->language;
}


$surveyinfo = getSurveyInfo($surveyid);
if (Permission::model()->hasSurveyPermission($surveyid, 'responses','update'))
{
Expand Down Expand Up @@ -594,7 +594,7 @@ public function editdata($subaction, $id, $surveyid, $language='')
'subaction' => $subaction,
'part' => 'header'
);

$aViewUrls[] = 'dataentry_header_view';
$aViewUrls[] = 'edit';

Expand Down Expand Up @@ -1492,20 +1492,20 @@ public function update()

$onerecord_link = $this->getController()->createUrl('/admin/responses/sa/view/surveyid/'.$surveyid.'/id/'.$id);
$allrecords_link = $this->getController()->createUrl('/admin/responses/sa/index/surveyid/'.$surveyid);


$aDataentryoutput .= "<div class='messagebox ui-corner-all'><div class='successheader'>".gT("Success")."</div>\n"
.gT("Record has been updated.")."<br /><br />\n"
."<input type='submit' value='".gT("View This Record")."' onclick=\"window.open('$onerecord_link', '_top')\" /><br /><br />\n"
."<input type='submit' value='".gT("Browse responses")."' onclick=\"window.open('$allrecords_link', '_top')\" />\n"
."</div>\n";

$aDataentryoutput = '<div class="jumbotron message-box">';
$aDataentryoutput .= '<h2>'.gT("Success").'</h2>';
$aDataentryoutput .= '<h2>'.gT("Success").'</h2>';
$aDataentryoutput .= '<p class="lead">'.gT("Record has been updated.").'</p>';
$aDataentryoutput .= "<input type='submit' class='btn btn-lg btn-default' value='".gT("View This Record")."' onclick=\"window.open('$onerecord_link', '_top')\" /><br /><br />\n"
."<input type='submit' class='btn btn-lg btn-default' value='".gT("Browse responses")."' onclick=\"window.open('$allrecords_link', '_top')\" />\n";
$aDataentryoutput .= '</div>';
$aDataentryoutput .= '</div>';

$aViewUrls['output'] = $aDataentryoutput;
$this->_renderWrappedTemplate('dataentry', $aViewUrls, $aData);
Expand Down Expand Up @@ -1955,9 +1955,11 @@ public function view($surveyid, $lang=NULL)

$deqquery = "SELECT * FROM {{questions}} WHERE sid=$surveyid AND parent_qid=0 AND gid={$degrow['gid']} AND language='{$sDataEntryLanguage}'";
$deqrows = (array) dbExecuteAssoc($deqquery)->readAll();
$aDataentryoutput .= "\t<tr>\n"
."<td colspan='3' align='center'><strong>".flattenText($degrow['group_name'],true)."</strong></td>\n"
$aDataentryoutput .= "\t<tr class='info'>\n"
."<!-- Inside controller dataentry.php -->"
."<td colspan='3'><h4>".flattenText($degrow['group_name'],true)."</h4></td>\n"
."\t</tr>\n";

$gid = $degrow['gid'];

$aDataentryoutput .= "\t<tr class='data-entry-separator'><td colspan='3'></td></tr>\n";
Expand Down Expand Up @@ -1985,24 +1987,22 @@ public function view($surveyid, $lang=NULL)

if (($relevance != '' && $relevance != '1') || ($validation != '') || ($array_filter_help != ''))
{
$showme = '';
$showme = '<div class="alert alert-warning col-sm-8 col-sm-offset-2" role="alert">';
if ($bgc == "even") {$bgc = "odd";} else {$bgc = "even";} //Do no alternate on explanation row
if ($relevance != '' && $relevance != '1') {
$showme = "[".gT("Only answer this if the following conditions are met:",'html',$sDataEntryLanguage)."]<br />$explanation\n";
}
if ($showme != '' && $validation != '') {
$showme .= '<br/>';
$showme = '<strong>'.gT("Only answer this if the following conditions are met:",'html',$sDataEntryLanguage)."</strong><br />$explanation\n";
}
if ($validation != '') {
$showme .= "[".gT("The answer(s) must meet these validation criteria:",'html',$sDataEntryLanguage)."]<br />$validation\n";
$showme .= '<strong>'.gT("The answer(s) must meet these validation criteria:",'html',$sDataEntryLanguage)."</strong><br />$validation\n";
}
if ($showme != '' && $array_filter_help != '') {
$showme .= '<br/>';
}
if ($array_filter_help != '') {
$showme .= "[".gT("The answer(s) must meet these array_filter criteria:",'html',$sDataEntryLanguage)."]<br />$array_filter_help\n";
$showme .= '<strong>'.gT("The answer(s) must meet these array_filter criteria:",'html',$sDataEntryLanguage)."</strong><br />$array_filter_help\n";
}
$cdata['explanation'] = "<tr class ='data-entry-explanation danger'><td class='data-entry-small-text' colspan='3' align='left'>$showme</td></tr>\n";
$showme .= '</div>';
$cdata['explanation'] = "<tr class ='data-entry-explanation'><td class='data-entry-small-text' colspan='3' align='left'>$showme</td></tr>\n";
}

//END OF GETTING CONDITIONS
Expand Down Expand Up @@ -2324,12 +2324,12 @@ public function view($surveyid, $lang=NULL)
}

$aViewUrls[] = 'active_html_view';
$aData['sidebar']['state'] = "close";

$aData['sidebar']['state'] = "close";
$aData['menu']['edition'] = true;
$aData['menu']['save'] = true;
$aData['menu']['close'] = true;
$aData['menu']['close'] = true;

$this->_renderWrappedTemplate('dataentry', $aViewUrls, $aData);
}
}
Expand Down Expand Up @@ -2421,19 +2421,17 @@ protected function _renderWrappedTemplate($sAction = 'dataentry', $aViewUrls = a
{
if(isset($aData['surveyid']))
$iSurveyId = $aData['surveyid'];

if(isset($_POST['sid']))
$iSurveyId = $_POST['sid'];


$aData['display']['menu_bars']['browse'] = gT("Data entry");
$surveyinfo = Survey::model()->findByPk($iSurveyId)->surveyinfo;
$aData["surveyinfo"] = $surveyinfo;
$aData["surveyinfo"] = $surveyinfo;
$aData['title_bar']['title'] = gT("Data entry");
}
parent::_renderWrappedTemplate($sAction, $aViewUrls, $aData);
}

}


3 changes: 1 addition & 2 deletions application/extensions/bootstrap/css/bootstrap.css
Expand Up @@ -313,7 +313,6 @@ img {
hr {
margin-top: 20px;
margin-bottom: 20px;
border: 0;
}
.sr-only {
position: absolute;
Expand Down Expand Up @@ -3644,7 +3643,7 @@ a.badge:focus {
.alert {
padding: 15px;
margin-bottom: 20px;

border-radius: 4px;
}
.alert h4 {
Expand Down
25 changes: 13 additions & 12 deletions application/helpers/expressions/em_core_helper.php
Expand Up @@ -1549,7 +1549,7 @@ public function GetPrettyPrintString()
}

if ($this->groupSeq == -1 || $groupSeq == -1 || $questionSeq == -1 || $this->questionSeq == -1) {
$class = 'em-var-static';
$class = 'em-var-static';
}
elseif ($groupSeq > $this->groupSeq) {
$class = 'em-var-before em-var-diffgroup';
Expand Down Expand Up @@ -1632,6 +1632,7 @@ public function GetPrettyPrintString()
}
$sClass='em-expression';
$sClass.=($bHaveError)?" em-haveerror":"";
//return "<span class='$sClass'>" . implode('', $stringParts) . "</span>";
return "<span class='$sClass'>" . implode('', $stringParts) . "</span>";
}

Expand Down Expand Up @@ -2556,14 +2557,14 @@ function exprmgr_stripos($haystack , $needle ,$offset=0)
* @param string $haystack : checked string
* @param string $needle : string to find
* @param boolean $before_needle : portion to return
* @return string|false
* @return string|false
*/
function exprmgr_stristr($haystack,$needle,$before_needle=false)
{
return mb_stristr($haystack,$needle,$before_needle,'UTF-8');
}
/**
* Get unicode string length
* Get unicode string length
* @param string $string
* @return int
*/
Expand All @@ -2589,14 +2590,14 @@ function exprmgr_strpos($haystack , $needle ,$offset=0)
* @param string $haystack : checked string
* @param string $needle : string to find
* @param boolean $before_needle : portion to return
* @return string|false
* @return string|false
*/
function exprmgr_strstr($haystack,$needle,$before_needle=false)
{
return mb_strstr($haystack,$needle,$before_needle,'UTF-8');
}
/**
* Make an unicode string lowercase
* Make an unicode string lowercase
* @param string $string
* @return string
*/
Expand All @@ -2605,7 +2606,7 @@ function exprmgr_strtolower($string)
return mb_strtolower ($string,'UTF-8');
}
/**
* Make an unicode string uppercase
* Make an unicode string uppercase
* @param string $string
* @return string
*/
Expand Down Expand Up @@ -2660,20 +2661,20 @@ function exprmgr_sumifop($args)

/**
* Find the closest matching numerical input values in a list an replace it by the
* corresponding value within another list
*
* corresponding value within another list
*
* @author Johannes Weberhofer, 2013
*
* @param numeric $fValueToReplace
* @param numeric $iStrict - 1 for exact matches only otherwise interpolation the
* @param numeric $iStrict - 1 for exact matches only otherwise interpolation the
* closest value should be returned
* @param string $sTranslateFromList - comma seperated list of numeric values to translate from
* @param string $sTranslateToList - comma seperated list of numeric values to translate to
* @return numeric
*/
function exprmgr_convert_value($fValueToReplace, $iStrict, $sTranslateFromList, $sTranslateToList)
function exprmgr_convert_value($fValueToReplace, $iStrict, $sTranslateFromList, $sTranslateToList)
{
if ( (is_numeric($fValueToReplace)) && ($iStrict!=null) && ($sTranslateFromList!=null) && ($sTranslateToList!=null) )
if ( (is_numeric($fValueToReplace)) && ($iStrict!=null) && ($sTranslateFromList!=null) && ($sTranslateToList!=null) )
{
$aFromValues = explode( ',', $sTranslateFromList);
$aToValues = explode( ',', $sTranslateToList);
Expand All @@ -2695,7 +2696,7 @@ function exprmgr_convert_value($fValueToReplace, $iStrict, $sTranslateFromList,
$fMinimumDiff = $fCurrentDiff;
$iNearestIndex = $i;
}
}
}
if ( $iStrict !== 1 ) {
return $aToValues[$iNearestIndex];
}
Expand Down
44 changes: 23 additions & 21 deletions application/views/admin/dataentry/caption_view.php
Expand Up @@ -2,37 +2,39 @@
dataentry/caption_view.php
-->
<div class="side-body">
<h3><?php eT('Question Groups in this survey'); ?></h3>
<h3><?php eT("Data entry"); ?></h3>
<div class="row">
<div class="col-lg-12 content-right">

<!-- Survey name and description -->
<div class="jumbotron ">
<h2><?php echo stripJavaScript($thissurvey['name']); ?></h2>
<p><?php echo flattenText($thissurvey['description'],true); ?></p>
</div>
<?php echo CHtml::form(array("admin/dataentry/sa/insert"), 'post', array('name'=>'addsurvey', 'id'=>'addsurvey', 'enctype'=>'multipart/form-data'));?>
<table class='data-entry-tbl table'>
<tr>
<td colspan='3'>
<strong><?php echo stripJavaScript($thissurvey['name']); ?></strong>
<br /><?php echo flattenText($thissurvey['description'],true); ?>
</td>
</tr>

<tr class='data-entry-separator'><td colspan='3'></td></tr>

<?php if (count(Survey::model()->findByPk($surveyid)->additionalLanguages)>0)
{ ?>
<tr>
<td colspan='3'>
<?php echo $langlistbox; ?>
</td>
<tr class='data-entry-separator'>
<td colspan='3'></td>
</tr>

<tr class='data-entry-separator'><td colspan='3'></td></tr>
<?php }
<?php if (count(Survey::model()->findByPk($surveyid)->additionalLanguages)>0):?>
<tr>
<td colspan='3' class="langlistbox">
<?php echo $langlistbox; ?>
</td>
</tr>
<tr class='data-entry-separator'>
<td colspan='3'></td>
</tr>
<?php endif; ?>

if (tableExists('{{tokens_'.$thissurvey['sid'].'}}')) //Give entry field for token id
<?php if (tableExists('{{tokens_'.$thissurvey['sid'].'}}')) //Give entry field for token id
{ ?>
<tr>
<td valign='top' width='1%'></td>
<td valign='top' align='right' width='30%'><font color='red'>*</font><strong><?php echo gT("Token",'html',$sDataEntryLanguage); ?>:</strong></td>
<td valign='top' align='right' width='30%'><font color='red'>*</font>
<strong><?php echo gT("Token",'html',$sDataEntryLanguage); ?>:</strong>
</td>
<td valign='top' align='left' style='padding-left: 20px'>
<input type='text' id='token' name='token' onkeyup='activateSubmit(this);' />
</td>
Expand All @@ -54,7 +56,7 @@ function activateSubmit(me)
}
}
//--></script>
</td></tr>
</td></tr>
<?php }


Expand Down

0 comments on commit 4c5a875

Please sign in to comment.