Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merged revision(s) 11572 from source/limesurvey_ci:
Implement jqgrid at browse response table - by GCI participant Licker Nandor


git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_yii@11573 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
c-schmitz committed Dec 3, 2011
1 parent fae8130 commit 6892720
Show file tree
Hide file tree
Showing 8 changed files with 734 additions and 344 deletions.
705 changes: 506 additions & 199 deletions application/controllers/admin/browse.php

Large diffs are not rendered by default.

17 changes: 12 additions & 5 deletions application/controllers/admin/dataentry.php
Expand Up @@ -594,8 +594,12 @@ function import($surveyid)
* @param mixed $language
* @return
*/
function editdata($subaction,$id,$surveyid,$language)
function editdata($subaction,$id,$surveyid,$language='')
{
if ($language == '') {
$language = GetBaseLanguageFromSurveyID($surveyid);
}

$surveyid = sanitize_int($surveyid);
$id = sanitize_int($id);
if (!isset($sDataEntryLanguage))
Expand Down Expand Up @@ -1199,8 +1203,7 @@ function editdata($subaction,$id,$surveyid,$language)
{//file metadata
$metadata = json_decode($idrow[$fname['fieldname']], true);
$qAttributes = getQuestionAttributeValues($fname['qid']);

for ($i = 0; $i < $qAttributes['max_files'], isset($metadata[$i]); $i++)
for ($i = 0; $i < $qAttributes['max_num_of_files'], isset($metadata[$i]); $i++)
{
if ($qAttributes['show_title'])
$dataentryoutput .= '<tr><td width="25%">Title </td><td><input type="text" class="'.$fname['fieldname'].'" id="'.$fname['fieldname'].'_title_'.$i .'" name="title" size=50 value="'.htmlspecialchars($metadata[$i]["title"]) .'" /></td></tr>';
Expand Down Expand Up @@ -1952,7 +1955,7 @@ function insert()
{
if ($_FILES[$fieldname."_file_".$i]['error'] != 4)
{
$target = $CI->config->item('uploaddir')."/surveys/". $thissurvey['sid'] ."/files/".sRandomChars(20);
$target = $this->config->item('uploaddir')."/surveys/". $thissurvey['sid'] ."/files/".sRandomChars(20);
$size = 0.001 * $_FILES[$fieldname."_file_".$i]['size'];
$name = rawurlencode($_FILES[$fieldname."_file_".$i]['name']);

Expand Down Expand Up @@ -2170,7 +2173,7 @@ function view($surveyid,$lang=NULL)
if(isset($lang)) $lang=sanitize_languagecode($urlParam);
self::_getAdminHeader();

if (bHasSurveyPermission($surveyid, 'responses','read'))
if (bHasSurveyPermission($surveyid, 'responses', 'read'))
{
$clang = $this->limesurvey_lang;

Expand All @@ -2196,6 +2199,7 @@ function view($surveyid,$lang=NULL)

$langlistbox = languageDropdown($surveyid,$sDataEntryLanguage);
$thissurvey=getSurveyInfo($surveyid);

//This is the default, presenting a blank dataentry form
$fieldmap=createFieldMap($surveyid);
// PRESENT SURVEY DATAENTRY SCREEN
Expand Down Expand Up @@ -2293,11 +2297,13 @@ function view($surveyid,$lang=NULL)
$this->load->view("admin/dataentry/caption_view",$data);

$this->load->helper('database');
$this->load->helper('database');


// SURVEY NAME AND DESCRIPTION TO GO HERE
$degquery = "SELECT * FROM ".$this->db->dbprefix."groups WHERE sid=$surveyid AND language='{$sDataEntryLanguage}' ORDER BY ".$this->db->dbprefix."groups.group_order";
$degresult = db_execute_assoc($degquery);

// GROUP NAME
$dataentryoutput = '';
foreach ($degresult->result_array() as $degrow)
Expand All @@ -2306,6 +2312,7 @@ function view($surveyid,$lang=NULL)

$deqquery = "SELECT * FROM ".$this->db->dbprefix."questions WHERE sid=$surveyid AND parent_qid=0 AND gid={$degrow['gid']} AND language='{$sDataEntryLanguage}'";
$deqresult = db_execute_assoc($deqquery);

$dataentryoutput .= "\t<tr>\n"
."<td colspan='3' align='center'><strong>".FlattenText($degrow['group_name'],true)."</strong></td>\n"
."\t</tr>\n";
Expand Down
1 change: 1 addition & 0 deletions application/helpers/common_helper.php
Expand Up @@ -3132,6 +3132,7 @@ function getQuestionAttributeValues($qid, $type='')
}
$result = Questions::model()->findByAttributes(array('qid' => $qid)); //Checked
$row=$result->attributes;

if ($row===false) // Question was deleted while running the survey
{
$cache[$qid]=false;
Expand Down
13 changes: 6 additions & 7 deletions application/helpers/qanda_helper.php
Expand Up @@ -5303,13 +5303,12 @@ function do_shortfreetext($ia)

if ($_SESSION[$ia[1]]) {$answer .= str_replace("\\", "", $_SESSION[$ia[1]]);}

$answer .= "</textarea>\n";
}
elseif((int)($aQuestionAttributes['location_mapservice'])!=0){

$mapservice = $aQuestionAttributes['location_mapservice'];
$currentLocation = $_SESSION[$ia[1]];
$currentLatLong = null;
$answer .= "</textarea>\n";
}
elseif((int)($aQuestionAttributes['location_mapservice'])!=0){
$mapservice = $aQuestionAttributes['location_mapservice'];
$currentLocation = $_SESSION[$ia[1]];
$currentLatLong = null;

$floatLat = 0;
$floatLng = 0;
Expand Down
82 changes: 79 additions & 3 deletions application/models/surveys_dynamic_model.php
Expand Up @@ -32,6 +32,21 @@ function getSomeRecords($fields,$iSurveyID,$condition=FALSE,$order=FALSE)

return $data;
}

/**
* Get the records with ids from $iFrom to $iFrom + $iCount
* @param $iSurveyID ID of the survey
* @param $iFrom Beginning of the range
* @param $iCount Number of rows
* @param $sSortCol Sort the elements by this colum
* @param $sSortOrder Order of the sort
* @return mixed
*/
function getRecordsInRange($iSurveyID, $iFrom, $iCount, $sSortCol, $sSortOrder)
{
$this->db->order_by($sSortCol, $sSortOrder);
return $this->db->get('survey_'.$iSurveyID, $iCount, $iFrom);
}

function quotaCompletedCount($iSurveyID,$querycond)
{
Expand All @@ -40,10 +55,71 @@ function quotaCompletedCount($iSurveyID,$querycond)
return $this->db->query($querysel);
}

function insertRecords($iSurveyID,$data)
/**
* Insert a new response
* @param int $iSurveyID ID of the survey
* @param array $data The response
* @return mixed
*/
function insertRecords($iSurveyID, $data)
{
return $this->db->insert('survey_'.$iSurveyID, $data);
}

/**
* Get data from certain columns for a response
* @param array $aFields Array containing field names
* @param int $iSurveyID ID of the survey
* @param int $iResponseID ID of the response
* @return mixed
*/
function getFieldsForID($aFields, $iSurveyID, $iResponseID)
{
foreach ($aFields as $field)
{
$this->db->select($field);
}

$this->db->where('id', $iResponse);
return $this->db->get('survey_'.$iSurveyID);
}


/**
* Get a response from the database
* @param int $iSurveyID ID of the survey
* @param int $iResponseID ID of the response
* @return mixed
*/
function getResponse($iSurveyID, $iResponseID)
{
$this->db->where('id', $iResponseID);
return $this->db->get('survey_'.$iSurveyID);
}


}

function deleteResponse($iSurveyID, $iResponseID)
{
$this->db->where('id', $iResponseID);
return $this->db->delete('survey_'.$iSurveyID);
}

function getResponseCount($iSurveyID)
{
return $this->db->count_all_results('survey_'.$iSurveyID);
}


/**
* Update a response
* @param int $iSurveyID ID of the survey
* @param int $iResponseID ID of the response
* @param array $aData Array containg response data
* @return mixed
*/
function updateResponse($iSurveyID, $iResponseID, $aData)
{
$this->db->where('id', $iResponseID);
$this->db->update('survey_'.$iSurveyID, $aData);
}
}
4 changes: 2 additions & 2 deletions application/views/admin/browse/browsemenubar_view.php
Expand Up @@ -16,7 +16,7 @@
<a href='<?php echo $this->createUrl("admin/browse/$surveyid/all");?>' title="<?php echo $clang->gTview("Display Responses");?>">
<img name='ViewAll' src='<?php echo $imageurl;?>/document.png' title='' alt='<?php echo $clang->gT("Display Responses");?>' /></a>
<?php } else { ?>
<a href="#" accesskey='b' id='browseresponses' title="<?php echo $clang->gTview("Display Responses");?>" >
<a href="<?php echo site_url("admin/browse/$surveyid/all");?>" accesskey='b' id='browseresponses' title="<?php echo $clang->gTview("Display Responses");?>" >
<img src='<?php echo $imageurl;?>/document.png' alt='<?php echo $clang->gT("Display Responses");?>' name='ViewAll' /></a>

<div class="langpopup" id="browselangpopup"><?php echo $clang->gT("Please select a language:");?><ul>
Expand Down Expand Up @@ -76,4 +76,4 @@
<?php } ?>
</div>
</div>
</div>
</div>

0 comments on commit 6892720

Please sign in to comment.