• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP incompleteAnsFilterState函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中incompleteAnsFilterState函数的典型用法代码示例。如果您正苦于以下问题:PHP incompleteAnsFilterState函数的具体用法?PHP incompleteAnsFilterState怎么用?PHP incompleteAnsFilterState使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了incompleteAnsFilterState函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: vvexport

 public function vvexport()
 {
     $iSurveyID = sanitize_int(Yii::app()->request->getParam('surveyid'));
     $subaction = Yii::app()->request->getParam('subaction');
     //Exports all responses to a survey in special "Verified Voting" format.
     $clang = $this->getController()->lang;
     if (!hasSurveyPermission($iSurveyID, 'responses', 'export')) {
         return;
     }
     if ($subaction != "export") {
         $selecthide = "";
         $selectshow = "";
         $selectinc = "";
         if (incompleteAnsFilterState() == "incomplete") {
             $selectinc = "selected='selected'";
         } elseif (incompleteAnsFilterState() == "complete") {
             $selecthide = "selected='selected'";
         } else {
             $selectshow = "selected='selected'";
         }
         $data['selectinc'] = $selectinc;
         $data['selecthide'] = $selecthide;
         $data['selectshow'] = $selectshow;
         $data['surveyid'] = $iSurveyID;
         $data['display']['menu_bars']['browse'] = $clang->gT("Export VV file");
         $this->_renderWrappedTemplate('export', 'vv_view', $data);
     } elseif (isset($iSurveyID) && $iSurveyID) {
         //Export is happening
         $extension = sanitize_paranoid_string(returnGlobal('extension'));
         $fn = "vvexport_{$iSurveyID}." . $extension;
         $this->_addHeaders($fn, "text/comma-separated-values", 0, "cache");
         $s = "\t";
         $fieldmap = createFieldMap($iSurveyID, 'full', false, false, getBaseLanguageFromSurveyID($iSurveyID));
         $surveytable = "{{survey_{$iSurveyID}}}";
         Survey::model()->findByPk($iSurveyID)->language;
         $fieldnames = Yii::app()->db->schema->getTable($surveytable)->getColumnNames();
         //Create the human friendly first line
         $firstline = "";
         $secondline = "";
         foreach ($fieldnames as $field) {
             $fielddata = arraySearchByKey($field, $fieldmap, "fieldname", 1);
             if (count($fielddata) < 1) {
                 $firstline .= $field;
             } else {
                 $firstline .= preg_replace('/\\s+/', ' ', strip_tags($fielddata['question']));
             }
             $firstline .= $s;
             $secondline .= $field . $s;
         }
         $vvoutput = $firstline . "\n";
         $vvoutput .= $secondline . "\n";
         $query = "SELECT * FROM " . Yii::app()->db->quoteTableName($surveytable);
         if (incompleteAnsFilterState() == "incomplete") {
             $query .= " WHERE submitdate IS NULL ";
         } elseif (incompleteAnsFilterState() == "complete") {
             $query .= " WHERE submitdate >= '01/01/1980' ";
         }
         $result = Yii::app()->db->createCommand($query)->query();
         foreach ($result->readAll() as $row) {
             foreach ($fieldnames as $field) {
                 if (is_null($row[$field])) {
                     $value = '{question_not_shown}';
                 } else {
                     $value = trim($row[$field]);
                     // sunscreen for the value. necessary for the beach.
                     // careful about the order of these arrays:
                     // lbrace has to be substituted *first*
                     $value = str_replace(array("{", "\n", "\r", "\t"), array("{lbrace}", "{newline}", "{cr}", "{tab}"), $value);
                 }
                 // one last tweak: excel likes to quote values when it
                 // exports as tab-delimited (esp if value contains a comma,
                 // oddly enough).  So we're going to encode a leading quote,
                 // if it occurs, so that we can tell the difference between
                 // strings that "really are" quoted, and those that excel quotes
                 // for us.
                 $value = preg_replace('/^"/', '{quote}', $value);
                 // yay!  that nasty soab won't hurt us now!
                 if ($field == "submitdate" && !$value) {
                     $value = "NULL";
                 }
                 $sun[] = $value;
             }
             $beach = implode($s, $sun);
             $vvoutput .= $beach;
             unset($sun);
             $vvoutput .= "\n";
         }
         echo $vvoutput;
         exit;
     }
 }
开发者ID:ryu1inaba,项目名称:LimeSurvey,代码行数:91,代码来源:export.php


示例2: eT

                <?php 
eT("Statistics");
?>
            </h3>
        </div>


            <div class="text-right">
                <div class="form-group">
                    <div style="display:inline-block;position:relative;top:-65px;">
                    <label for='completionstate' class="control-label"><?php 
eT("Include:");
?>
 </label>
                    <?php 
echo CHtml::dropDownList('completionstate', incompleteAnsFilterState(), array("all" => gT("All responses", 'unescaped'), "complete" => gT("Complete only", 'unescaped'), "incomplete" => gT("Incomplete only", 'unescaped')), array('class' => 'form-control', 'style' => 'display: inline;width: auto;', 'data-url' => App()->createUrl('/admin/statistics/sa/setIncompleteanswers/')));
?>
                </div>
                </div>
            </div>

    </div>


    <div class="row">
        <div class="col-lg-12 content-right">
            <input type="hidden" id="showGraphOnPageLoad" />
            <div id='statisticsoutput' class='statisticsfilters'>
                <?php 
echo $output;
?>
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:31,代码来源:statistics_user_view.php


示例3: eT

dataend.png' alt='<?php 
    eT("Show last..");
    ?>
' /></a>
                <img src='<?php 
    echo $sImageURL;
    ?>
separator.gif' class='separator' alt='' />
                <?php 
}
$selectshow = '';
$selectinc = '';
$selecthide = '';
if (incompleteAnsFilterState() == "incomplete") {
    $selectinc = "selected='selected'";
} elseif (incompleteAnsFilterState() == "complete") {
    $selecthide = "selected='selected'";
} else {
    $selectshow = "selected='selected'";
}
?>
            <?php 
echo CHtml::form(array("admin/responses/sa/browse/surveyid/{$surveyid}/"), 'post', array('id' => 'browseresults'));
?>
                    <img src='<?php 
echo $sImageURL;
?>
blank.gif' width='31' height='20' alt='' />
                    <?php 
eT("Records displayed:");
?>
开发者ID:wrenchpilot,项目名称:LimeSurvey,代码行数:31,代码来源:browseallheader_view.php


示例4: run


//.........这里部分代码省略.........
      * question_order
      * language
      *
      * b) "groups" -> group_name + group_order *
      */
     //store all the data in $rows
     $rows = Question::model()->getQuestionList($surveyid, $language);
     //SORT IN NATURAL ORDER!
     usort($rows, 'groupOrderThenQuestionOrder');
     //put the question information into the filter array
     $filters = array();
     foreach ($rows as $row) {
         //store some column names in $filters array
         $filters[] = array($row['qid'], $row['gid'], $row['type'], $row['title'], $row['group_name'], flattenText($row['question']));
     }
     $aData['filters'] = $filters;
     //var_dump($filters);
     // SHOW ID FIELD
     $grapherror = false;
     $error = '';
     if (!function_exists("gd_info")) {
         $grapherror = true;
         $error .= '<br />' . $clang->gT('You do not have the GD Library installed. Showing charts requires the GD library to function properly.');
         $error .= '<br />' . $clang->gT('visit http://us2.php.net/manual/en/ref.image.php for more information') . '<br />';
     } elseif (!function_exists("imageftbbox")) {
         $grapherror = true;
         $error .= '<br />' . $clang->gT('You do not have the Freetype Library installed. Showing charts requires the Freetype library to function properly.');
         $error .= '<br />' . $clang->gT('visit http://us2.php.net/manual/en/ref.image.php for more information') . '<br />';
     }
     if ($grapherror) {
         unset($_POST['usegraph']);
     }
     //pre-selection of filter forms
     if (incompleteAnsFilterState() == "complete") {
         $selecthide = "selected='selected'";
         $selectshow = "";
         $selectinc = "";
     } elseif (incompleteAnsFilterState() == "incomplete") {
         $selecthide = "";
         $selectshow = "";
         $selectinc = "selected='selected'";
     } else {
         $selecthide = "";
         $selectshow = "selected='selected'";
         $selectinc = "";
     }
     $aData['selecthide'] = $selecthide;
     $aData['selectshow'] = $selectshow;
     $aData['selectinc'] = $selectinc;
     $aData['error'] = $error;
     $survlangs = Survey::model()->findByPk($surveyid)->additionalLanguages;
     $survlangs[] = Survey::model()->findByPk($surveyid)->language;
     $aData['survlangs'] = $survlangs;
     $aData['datestamp'] = $datestamp;
     //if the survey contains timestamps you can filter by timestamp, too
     //Output selector
     //second row below options -> filter settings headline
     $filterchoice_state = returnGlobal('filterchoice_state');
     $aData['filterchoice_state'] = $filterchoice_state;
     /*
     * let's go through the filter array which contains
     * 	['qid'],
     ['gid'],
     ['type'],
     ['title'],
     ['group_name'],
开发者ID:josetorerobueno,项目名称:test_repo,代码行数:67,代码来源:statistics.php


示例5: SPSSGetQuery

/**
* Creates a query string with all fields for the export
* @param
* @return CDbCommand
*/
function SPSSGetQuery($iSurveyID, $limit = null, $offset = null)
{
    $bDataAnonymized = Survey::model()->findByPk($iSurveyID)->anonymized == 'Y';
    $tokensexist = tableExists('tokens_' . $iSurveyID);
    #See if tokens are being used
    $query = App()->db->createCommand();
    $query->from('{{survey_' . $iSurveyID . '}} s');
    $columns = array('s.*');
    if (isset($tokensexist) && $tokensexist == true && !$bDataAnonymized && Permission::model()->hasSurveyPermission($iSurveyID, 'tokens', 'read')) {
        $tokenattributes = array_keys(getTokenFieldsAndNames($iSurveyID, false));
        foreach ($tokenattributes as $attributefield) {
            //Drop the token field, since it is in the survey too
            if ($attributefield != 'token') {
                $columns[] = 't.' . $attributefield;
            }
        }
        $query->leftJoin('{{tokens_' . $iSurveyID . '}} t', App()->db->quoteColumnName('s.token') . ' = ' . App()->db->quoteColumnName('t.token'));
        //LEFT JOIN {{tokens_$iSurveyID}} t ON ";
    }
    $query->select($columns);
    switch (incompleteAnsFilterState()) {
        case 'incomplete':
            //Inclomplete answers only
            $query->where('s.submitdate IS NULL');
            break;
        case 'complete':
            //Inclomplete answers only
            $query->where('s.submitdate IS NOT NULL');
            break;
    }
    if (!empty($limit) & !is_null($offset)) {
        $query->limit((int) $limit, (int) $offset);
    }
    return $query;
}
开发者ID:wrenchpilot,项目名称:LimeSurvey,代码行数:40,代码来源:export_helper.php


示例6: time

 public function time($iSurveyID)
 {
     $aData = $this->_getData(array('iSurveyId' => $iSurveyID));
     extract($aData);
     $aViewUrls = array();
     if ($aData['surveyinfo']['savetimings'] != "Y") {
         die;
     }
     if (Yii::app()->request->getPost('deleteanswer') && Yii::app()->request->getPost('deleteanswer') != '' && Yii::app()->request->getPost('deleteanswer') != 'marked' && Permission::model()->hasSurveyPermission($iSurveyID, 'responses', 'delete')) {
         $iResponseID = (int) Yii::app()->request->getPost('deleteanswer');
         SurveyDynamic::model($iSurveyID)->deleteByPk($iResponseID);
         SurveyTimingDynamic::model($iSurveyID)->deleteByPk($iResponseID);
     }
     if (Yii::app()->request->getPost('markedresponses') && count(Yii::app()->request->getPost('markedresponses')) > 0) {
         if (Yii::app()->request->getPost('deleteanswer') && Yii::app()->request->getPost('deleteanswer') === 'marked' && Permission::model()->hasSurveyPermission($iSurveyID, 'responses', 'delete')) {
             foreach (Yii::app()->request->getPost('markedresponses') as $iResponseID) {
                 $iResponseID = (int) $iResponseID;
                 SurveyDynamic::model($iSurveyID)->deleteByPk($iResponseID);
                 SurveyTimingDynamic::model($iSurveyID)->deleteByPk($iResponseID);
             }
         }
     }
     $fields = createTimingsFieldMap($iSurveyID, 'full', true, false, $aData['language']);
     foreach ($fields as $fielddetails) {
         // headers for answer id and time data
         if ($fielddetails['type'] == 'id') {
             $fnames[] = array($fielddetails['fieldname'], $fielddetails['question']);
         }
         if ($fielddetails['type'] == 'interview_time') {
             $fnames[] = array($fielddetails['fieldname'], gT('Total time'));
         }
         if ($fielddetails['type'] == 'page_time') {
             $fnames[] = array($fielddetails['fieldname'], gT('Group') . ": " . $fielddetails['group_name']);
         }
         if ($fielddetails['type'] == 'answer_time') {
             $fnames[] = array($fielddetails['fieldname'], gT('Question') . ": " . $fielddetails['title']);
         }
     }
     $fncount = count($fnames);
     //NOW LETS CREATE A TABLE WITH THOSE HEADINGS
     foreach ($fnames as $fn) {
         if (!isset($currentgroup)) {
             $currentgroup = $fn[1];
             $gbc = "oddrow";
         }
         if ($currentgroup != $fn[1]) {
             $currentgroup = $fn[1];
             if ($gbc == "oddrow") {
                 $gbc = "evenrow";
             } else {
                 $gbc = "oddrow";
             }
         }
     }
     $aData['fnames'] = $fnames;
     $start = Yii::app()->request->getParam('start', 0);
     $limit = Yii::app()->request->getParam('limit', 50);
     if (!$limit) {
         $limit = 50;
     }
     //LETS COUNT THE DATA
     $oCriteria = new CdbCriteria();
     $oCriteria->select = 'tid';
     $oCriteria->join = "INNER JOIN {{survey_{$iSurveyID}}} s ON t.id=s.id";
     $oCriteria->condition = 'submitdate IS NOT NULL';
     $dtcount = SurveyTimingDynamic::model($iSurveyID)->count($oCriteria);
     // or die("Couldn't get response data");
     if ($limit > $dtcount) {
         $limit = $dtcount;
     }
     //NOW LETS SHOW THE DATA
     $oCriteria = new CdbCriteria();
     $oCriteria->join = "INNER JOIN {{survey_{$iSurveyID}}} s ON t.id=s.id";
     $oCriteria->condition = 'submitdate IS NOT NULL';
     $oCriteria->order = "s.id " . (Yii::app()->request->getParam('order') == 'desc' ? 'desc' : 'asc');
     $oCriteria->offset = $start;
     $oCriteria->limit = $limit;
     $dtresult = SurveyTimingDynamic::model($iSurveyID)->findAllAsArray($oCriteria);
     $dtcount2 = count($dtresult);
     $cells = $fncount + 1;
     //CONTROL MENUBAR
     $last = $start - $limit;
     $next = $start + $limit;
     $end = $dtcount - $limit;
     if ($end < 0) {
         $end = 0;
     }
     if ($last < 0) {
         $last = 0;
     }
     if ($next >= $dtcount) {
         $next = $dtcount - $limit;
     }
     if ($end < 0) {
         $end = 0;
     }
     $aData['sCompletionStateValue'] = incompleteAnsFilterState();
     $aData['start'] = $start;
     $aData['limit'] = $limit;
     $aData['last'] = $last;
//.........这里部分代码省略.........
开发者ID:BertHankes,项目名称:LimeSurvey,代码行数:101,代码来源:responses.php


示例7: _listcolumn

 /**
  *  Returns a simple list of values in a particular column, that meet the requirements of the SQL
  */
 function _listcolumn($surveyid, $column, $sortby = "", $sortmethod = "", $sorttype = "")
 {
     $search['condition'] = Yii::app()->db->quoteColumnName($column) . " != ''";
     $sDBDriverName = Yii::app()->db->getDriverName();
     if ($sDBDriverName == 'sqlsrv' || $sDBDriverName == 'mssql' || $sDBDriverName == 'dblib') {
         $search['condition'] = "CAST(" . Yii::app()->db->quoteColumnName($column) . " as varchar) != ''";
     }
     //filter incomplete answers if set
     if (incompleteAnsFilterState() == "incomplete") {
         $search['condition'] .= " AND submitdate is null";
     } elseif (incompleteAnsFilterState() == "complete") {
         $search['condition'] .= " AND submitdate is not null";
     }
     //Look for any selects/filters set in the original statistics query, and apply them to the column listing
     if (isset(Yii::app()->session['statistics_selects_' . $surveyid]) && is_array(Yii::app()->session['statistics_selects_' . $surveyid])) {
         foreach (Yii::app()->session['statistics_selects_' . $surveyid] as $sql) {
             $search['condition'] .= " AND {$sql}";
         }
     }
     if ($sortby != '') {
         if ($sDBDriverName == 'sqlsrv' || $sDBDriverName == 'mssql' || $sDBDriverName == 'dblib') {
             $sortby = "CAST(" . Yii::app()->db->quoteColumnName($sortby) . " as varchar)";
         } else {
             $sortby = Yii::app()->db->quoteColumnName($sortby);
         }
         if ($sorttype == 'N') {
             $sortby = "({$sortby} * 1)";
         }
         //Converts text sorting into numerical sorting
         $search['order'] = $sortby . ' ' . $sortmethod;
     }
     $results = SurveyDynamic::model($surveyid)->findAll($search);
     $output = array();
     foreach ($results as $row) {
         $output[] = array("id" => $row['id'], "value" => $row[$column]);
     }
     return $output;
 }
开发者ID:krsandesh,项目名称:LimeSurvey,代码行数:41,代码来源:statistics_helper.php


示例8: eT

    <div class="panel-heading">
        <h4 class="panel-title"><?php 
eT("Data selection");
?>
</h4>
    </div>
    <div class="panel-body">


        <div class='form-group'>
            <label for='completionstate' class="col-sm-4 control-label"><?php 
eT("Include:");
?>
 </label>
            <?php 
$this->widget('yiiwheels.widgets.buttongroup.WhButtonGroup', array('name' => 'completionstate', 'value' => incompleteAnsFilterState(), 'selectOptions' => array("all" => gT("All responses", 'unescaped'), "complete" => gT("Complete only", 'unescaped'), "incomplete" => gT("Incomplete only", 'unescaped'))));
?>
        </div>

        <div class='form-group'>
            <label class="col-sm-4 control-label" for='viewsummaryall'><?php 
eT("View summary of all available fields:");
?>
</label>
            <div class='col-sm-1'>
                <?php 
$this->widget('yiiwheels.widgets.switch.WhSwitch', array('name' => 'viewsummaryall', 'id' => 'viewsummaryall', 'value' => isset($_POST['viewsummaryall']), 'onLabel' => gT('On'), 'offLabel' => gT('Off')));
?>
            </div>
        </div>
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:30,代码来源:_dataselection.php


示例9: previous

 /**
  * Return previous id if previous response exist in database
  *
  * @param integer $srid : actual save survey id
  * @param boolean $usefilterstate
  *
  * @return integer
  */
 public function previous($srid, $usefilterstate = false)
 {
     $previous = false;
     if ($usefilterstate && incompleteAnsFilterState() == 'incomplete') {
         $wherefilterstate = 'submitdate IS NULL';
     } elseif ($usefilterstate && incompleteAnsFilterState() == 'complete') {
         $wherefilterstate = 'submitdate IS NOT NULL';
     } else {
         $wherefilterstate = '1=1';
     }
     if (Yii::app()->db->schema->getTable($this->tableName())) {
         $data = Yii::app()->db->createCommand()->select("id")->from($this->tableName())->where(array('and', $wherefilterstate, 'id < :id'), array(':id' => $srid))->order('id DESC')->queryRow();
         if ($data) {
             $previous = $data['id'];
         }
     }
     return $previous;
 }
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:26,代码来源:SurveyDynamic.php


示例10: SPSSGetQuery

/**
* Creates a query string with all fields for the export
* @param
* @return string
*/
function SPSSGetQuery($iSurveyID)
{
    $bDataAnonymized = Survey::model()->findByPk($iSurveyID)->anonymized == 'Y';
    $tokensexist = tableExists('tokens_' . $iSurveyID);
    #See if tokens are being used
    if (isset($tokensexist) && $tokensexist == true && !$bDataAnonymized && hasSurveyPermission($iSurveyID, 'tokens', 'read')) {
        $query = "SELECT ";
        $tokenattributes = array_keys(getTokenFieldsAndNames($iSurveyID, false));
        foreach ($tokenattributes as $attributefield) {
            //Drop the token field, since it is in the survey too
            if ($attributefield != 'token') {
                $query .= Yii::app()->db->quoteColumnName('t.' . $attributefield) . ',';
            }
        }
        $query .= "s.*\n        FROM {{survey_{$iSurveyID}}} s\n        LEFT JOIN {{tokens_{$iSurveyID}}} t ON s.token = t.token";
    } else {
        $query = "SELECT s.*\n        FROM {{survey_{$iSurveyID}}} s";
    }
    switch (incompleteAnsFilterState()) {
        case 'incomplete':
            //Inclomplete answers only
            $query .= ' WHERE s.submitdate is null ';
            break;
        case 'complete':
            //Inclomplete answers only
            $query .= ' WHERE s.submitdate is not null ';
            break;
    }
    return $query;
}
开发者ID:pmaonline,项目名称:limesurvey-quickstart,代码行数:35,代码来源:export_helper.php


示例11: vvexport

 public function vvexport()
 {
     $iSurveyId = sanitize_int(Yii::app()->request->getParam('surveyid'));
     $subaction = Yii::app()->request->getParam('subaction');
     //Exports all responses to a survey in special "Verified Voting" format.
     if (!Permission::model()->hasSurveyPermission($iSurveyId, 'responses', 'export')) {
         Yii::app()->session['flashmessage'] = gT("You do not have sufficient rights to access this page.");
         $this->getController()->redirect($this->getController()->createUrl("/admin/survey/sa/view/surveyid/{$iSurveyId}"));
     }
     if ($subaction != "export") {
         $aData['selectincansstate'] = incompleteAnsFilterState();
         $aData['surveyid'] = $iSurveyId;
         $aData['display']['menu_bars']['browse'] = gT("Export VV file");
         $fieldmap = createFieldMap($iSurveyId, 'full', false, false, getBaseLanguageFromSurveyID($iSurveyId));
         Survey::model()->findByPk($iSurveyId)->language;
         $surveytable = "{{survey_{$iSurveyId}}}";
         // Control if fieldcode are unique
         $fieldnames = Yii::app()->db->schema->getTable($surveytable)->getColumnNames();
         foreach ($fieldnames as $field) {
             $fielddata = arraySearchByKey($field, $fieldmap, "fieldname", 1);
             $fieldcode[] = viewHelper::getFieldCode($fielddata, array("LEMcompat" => true));
         }
         $aData['uniquefieldcode'] = count(array_unique($fieldcode)) == count($fieldcode);
         // Did we need more control ?
         $aData['vvversionseleted'] = $aData['uniquefieldcode'] ? 2 : 1;
         $this->_renderWrappedTemplate('export', 'vv_view', $aData);
     } elseif (isset($iSurveyId) && $iSurveyId) {
         //Export is happening
         $extension = sanitize_paranoid_string(returnGlobal('extension'));
         $vvVersion = (int) Yii::app()->request->getPost('vvversion');
         $vvVersion = in_array($vvVersion, array(1, 2)) ? $vvVersion : 2;
         // Only 2 version actually, default to 2
         $fn = "vvexport_{$iSurveyId}." . $extension;
         $this->_addHeaders($fn, "text/comma-separated-values", 0, "cache");
         $s = "\t";
         $fieldmap = createFieldMap($iSurveyId, 'full', false, false, getBaseLanguageFromSurveyID($iSurveyId));
         $surveytable = "{{survey_{$iSurveyId}}}";
         Survey::model()->findByPk($iSurveyId)->language;
         $fieldnames = Yii::app()->db->schema->getTable($surveytable)->getColumnNames();
         //Create the human friendly first line
         $firstline = "";
         $secondline = "";
         foreach ($fieldnames as $field) {
             $fielddata = arraySearchByKey($field, $fieldmap, "fieldname", 1);
             if (count($fielddata) < 1) {
                 $firstline .= $field;
             } else {
                 $firstline .= preg_replace('/\\s+/', ' ', strip_tags($fielddata['question']));
             }
             $firstline .= $s;
             if ($vvVersion == 2) {
                 $fieldcode = viewHelper::getFieldCode($fielddata, array("LEMcompat" => true));
                 $fieldcode = $fieldcode ? $fieldcode : $field;
                 // $fieldcode is empty for token if there are no token table
             } else {
                 $fieldcode = $field;
             }
             $secondline .= $fieldcode . $s;
         }
         $vvoutput = $firstline . "\n";
         $vvoutput .= $secondline . "\n";
         $query = "SELECT * FROM " . Yii::app()->db->quoteTableName($surveytable);
         if (incompleteAnsFilterState() == "incomplete") {
             $query .= " WHERE submitdate IS NULL ";
         } elseif (incompleteAnsFilterState() == "complete") {
             $query .= " WHERE submitdate >= '01/01/1980' ";
         }
         $result = Yii::app()->db->createCommand($query)->query();
         echo $vvoutput;
         foreach ($result as $row) {
             foreach ($fieldnames as $field) {
                 if (is_null($row[$field])) {
                     $value = '{question_not_shown}';
                 } else {
                     $value = trim($row[$field]);
                     // sunscreen for the value. necessary for the beach.
                     // careful about the order of these arrays:
                     // lbrace has to be substituted *first*
                     $value = str_replace(array("{", "\n", "\r", "\t"), array("{lbrace}", "{newline}", "{cr}", "{tab}"), $value);
                 }
                 // one last tweak: excel likes to quote values when it
                 // exports as tab-delimited (esp if value contains a comma,
                 // oddly enough).  So we're going to encode a leading quote,
                 // if it occurs, so that we can tell the difference between
                 // strings that "really are" quoted, and those that excel quotes
                 // for us.
                 $value = preg_replace('/^"/', '{quote}', $value);
                 // yay!  that nasty soab won't hurt us now!
                 if ($field == "submitdate" && !$value) {
                     $value = "NULL";
                 }
                 $sun[] = $value;
             }
             /* it is important here to stream output data, line by line
              * in order to avoid huge memory consumption when exporting large
              * quantities of answers */
             echo implode($s, $sun) . "\n";
             unset($sun);
         }
         exit;
//.........这里部分代码省略.........
开发者ID:ambientelivre,项目名称:LimeSurvey,代码行数:101,代码来源:export.php


示例12: generate_statistics


//.........这里部分代码省略.........
        Yii::import('application.libraries.admin.pear.Spreadsheet.Excel.Xlswriter', true);
        if ($pdfOutput == 'F') {
            $sFileName = $tempdir . '/statistic-survey' . $surveyid . '.xls';
            $workbook = new Xlswriter($sFileName);
        } else {
            $workbook = new Xlswriter();
        }
        $workbook->setVersion(8);
        // Inform the module that our data will arrive as UTF-8.
        // Set the temporary directory to avoid PHP error messages due to open_basedir restrictions and calls to tempnam("", ...)
        $workbook->setTempDir($tempdir);
        // Inform the module that our data will arrive as UTF-8.
        // Set the temporary directory to avoid PHP error messages due to open_basedir restrictions and calls to tempnam("", ...)
        if (!empty($tempdir)) {
            $workbook->setTempDir($tempdir);
        }
        if ($pdfOutput != 'F') {
            $workbook->send('statistic-survey' . $surveyid . '.xls');
        }
        // Creating the first worksheet
        $sheet =& $workbook->addWorksheet(utf8_decode('results-survey' . $surveyid));
        $sheet->setInputEncoding('utf-8');
        $sheet->setColumn(0, 20, 20);
        $separator = "~|";
        /**XXX*/
    }
    /**
     * Start generating
     */
    $selects = buildSelects($allfields, $surveyid, $language);
    //count number of answers
    $query = "SELECT count(*) FROM {{survey_{$surveyid}}}";
    //if incompleted answers should be filtert submitdate has to be not null
    if (incompleteAnsFilterState() == "inc") {
        $query .= " WHERE submitdate is null";
    } elseif (incompleteAnsFilterState() == "filter") {
        $query .= " WHERE submitdate is not null";
    }
    $result = Yii::app()->db->createCommand($query)->query();
    //$total = total number of answers
    $row = $result->read();
    $total = reset($row);
    //are there any filters that have to be taken care of?
    if (isset($selects) && $selects) {
        //filter incomplete answers?
        if (incompleteAnsFilterState() == "filter" || incompleteAnsFilterState() == "inc") {
            $query .= " AND ";
        } else {
            $query .= " WHERE ";
        }
        //add filter criteria to SQL
        $query .= implode(" AND ", $selects);
    }
    //get me some data Scotty
    $result = Yii::app()->db->createCommand($query)->query();
    //put all results into $results
    $row = $result->read();
    $results = reset($row);
    if ($total) {
        $percent = sprintf("%01.2f", $results / $total * 100);
    }
    switch ($outputType) {
        case "xls":
            $xlsRow = 0;
            $sheet->write($xlsRow, 0, $statlang->gT("Number of records in this query:", 'unescaped'));
            $sheet->write($xlsRow, 1, $results);
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:67,代码来源:statistics_helper.php


示例13: getQuartile

 /**
  * Get the quartile using minitab method
  * 
  * L=(1/4)(n+1), U=(3/4)(n+1)
  * Minitab linear interpolation between the two
  * closest data points. Minitab would let L = 2.5 and find the value half way between the
  * 2nd and 3rd data points. In our example, that would be (4+9)/2 =
  * 6.5. Similarly, the upper quartile value would be half way between
  * the 7th and 8th data points, which would be (49+64)/2 = 56.5. If L
  * were 2.25, Minitab would find the value one fourth of the way
  * between the 2nd and 3rd data points and if L were 2.75, Minitab
  * would find the value three fourths of the way between the 2nd and
  * 3rd data points.
  * 
  * @staticvar null $sid
  * @staticvar int $recordCount
  * @staticvar null $field
  * @staticvar null $allRows
  * @param 0|1|2|3 $quartile use 0 for return of recordcount, otherwise will return Q1,Q2,Q3
  * @param string $fieldname
  * @param int $surveyid
  * @param string $sql
  * @param bool $excludezeros
  * @return null|float
  */
 protected function getQuartile($quartile, $fieldname, $surveyid, $sql, $excludezeros)
 {
     static $sid = null;
     static $recordCount = 0;
     static $field = null;
     static $allRows = null;
     if ($surveyid !== $sid || $fieldname !== $field) {
         //get data
         $query = " FROM {{survey_{$surveyid}}} WHERE " . Yii::app()->db->quoteColumnName($fieldname) . " IS NOT null";
         //NO ZEROES
         if (!$excludezeros) {
             $query .= " AND " . Yii::app()->db->quoteColumnName($fieldname) . " != 0";
         }
         //filtering enabled?
         if (incompleteAnsFilterState() == "incomplete") {
             $query .= " AND submitdate is null";
         } elseif (incompleteAnsFilterState() == "complete") {
             $query .= " AND submitdate is not null";
         }
         //if $sql values have been passed to the statistics script from another script, incorporate them
         if ($sql != "NULL") {
             $query .= " AND {$sql}";
         }
     }
     if ($surveyid !== $sid) {
         $sid = $surveyid;
         $recordCount = 0;
         $field = null;
         // Reset cache
         //we just put the total number of records at the beginning of this array
         $recordCount = Yii::app()->db->createCommand("SELECT COUNT(" . Yii::app()->db->quoteColumnName($fieldname) . ")" . $query)->queryScalar();
     }
     if ($fieldname !== $field) {
         $field = $fieldname;
         $allRows = Yii::app()->db->createCommand("SELECT " . Yii::app()->db->quoteColumnName($fieldname) . $query . ' ORDER BY ' . Yii::app()->db->quoteColumnName($fieldname))->queryAll();
     }
     // Qx = (x/4) * (n+1) if not integer, interpolate
     switch ($quartile) {
         case 1:
         case 3:
             // Need at least 4 records
             if ($recordCount < 4) {
                 return;
             }
             break;
         case 2:
             // Need at least 2 records
             if ($recordCount < 2) {
                 return;
             }
             break;
         case 0:
             return $recordCount;
         default:
             return;
             break;
     }
     $q1 = $quartile / 4 * ($recordCount + 1);
     $row = $q1 - 1;
     // -1 since we start counting at 0
     if ($q1 === (int) $q1) {
         return $allRows[$row][$fieldname];
     } else {
         $diff = $q1 - (int) $q1;
         return $allRows[$row][$fieldname] + $diff * ($allRows[$row + 1][$fieldname] - $allRows[$row][$fieldname]);
     }
 }
开发者ID:ryu1inaba,项目名称:LimeSurvey,代码行数:92,代码来源:statistics_helper.php


示例14: SPSSGetQuery

/**
* Creates a query string with all fields for the export
* @param
* @return string
*/
function SPSSGetQuery($iSurveyID)
{
    $bDataAnonymized = Survey::model()->findByPk($iSurveyID)->anonymized == 'Y';
    $tokensexist = tableExists('tokens_' . $iSurveyID);
    #See if tokens are being used
    if (isset($tokensexist) && $tokensexist == true && !$bDataAnonymized) {
        $query = "SELECT ";
        $tokenattributes = getTokenFieldsAndNames($iSurveyID, false);
        foreach ($tokenattributes as $attributefield => $attributedescription) {
            //Drop the token field, since it is in the survey too
            if ($attributefield != 'token') {
                $query .= "t.{$attributefield}, ";
            }
        }
        $query .= "s.*\n        FROM {{survey_{$iSurveyID}}} s\n        LEFT JOIN {{tokens_{$iSurveyID}}} t ON s.token = t.token";
    } else {
        $query = "SELECT s.*\n        FROM {{survey_{$iSurveyID}}} s";
    }
    switch (incompleteAnsFilterState()) {
        case 'inc':
            //Inclomplete answers only
            $query .= ' WHERE s.submitdate is null ';
            break;
        case 'filter':
            //Inclomplete answers only
            $query .= ' WHERE s.submitdate is not null ';
            break;
    }
    return $query;
}
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:35,代码来源:export_helper.php


示例15: elseif

                <a href='<?php echo $this->createUrl("admin/responses/browse/surveyid/$surveyid/start/$next/limit/$limit"); ?>'>
                    <img src='<?php echo $sImageURL; ?>dataforward.png' alt='<?php $clang->eT("Show next.."); ?>' /></a>
                <a href='<?php echo $this->createUrl("admin/responses/browse/surveyid/$surveyid/start/$end/limit/$limit"); ?>'>
                    <img src='<?php echo $sImageURL; ?>dataend.png' alt='<?php $clang->eT("Show last.."); ?>' /></a>
                <img src='<?php echo $sImageURL; ?>separator.gif' class='separator' alt='' />
                <?php
                }
                $selectshow = '';
                $selectinc = '';
                $selecthide = '';

                if (incompleteAnsFilterState() == "inc")
                {
                    $selectinc = "selected='selected'";
                }
                elseif (incompleteAnsFilterState() == "filter")
                {
                    $selecthide = "selected='selected'";
                }
                else
                {
                    $selectshow = "selected='selected'";
                }
            ?>
            <form action='<?php echo $this->createUrl("admin/responses/browse/surveyid/$surveyid/"); ?>' id='browseresults' method='post'>
                    <img src='<?php echo $sImageURL; ?>blank.gif' width='31' height='20' alt='' />
                    <?php $clang->eT("Records displayed:"); ?><input type='text' size='4' value='<?php echo $dtcount2; ?>' name='limit' id='limit' />
                    &nbsp;&nbsp; <?php $clang->eT("Starting from:"); ?><input type='text' size='4' value='<?php echo $start; ?>' name='start' id='start' />
                    &nbsp;&nbsp; <input type='submit' value='<?php $clang->eT("Show"); ?>' />
                    &nbsp;&nbsp; <?php $clang->eT("Display:"); ?>
                    <?php echo CHtml::dropDownList('completionstate',$sCompletionStateValue,array('all'=> $clang->gT("All responses"),
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:31,代码来源:browseallheader_view.php


示例16: oldbrowse

 /**
  * @deprecated
  * */
 function oldbrowse($iSurveyID)
 {
     $aData = $this->_getData($iSurveyID);
     extract($aData);
     $aViewUrls = array();
     $sBrowseLanguage = $aData['language'];
     $tokenRequest = Yii::app()->request->getParam('token', null);
     /**
      * fnames is used as informational array
      * it containts
      *             $fnames[] = array(<dbfieldname>, <some strange title>, <questiontext>, <group_id>, <questiontype>);
      */
     if (Permission::model()->hasSurveyPermission($iSurveyID, 'responses', 'read')) {
         if (Yii::app()->request->getPost('sql')) {
             $aViewUrls[] = 'browseallfiltered_view';
         }
         //add token to top of list if survey is not private
         if ($aData['surveyinfo']['anonymized'] == "N" && tableExists('tokens_' . $iSurveyID)) {
             if (Permission::model()->hasSurveyPermission($iSurveyID, 'tokens', 'read')) {
                 $fnames[] = array("token", gT("Token ID"), 'code' => 'token');
                 $fnames[] = array("firstname", gT("First name"), 'code' => 'firstname');
                 // or token:firstname ?
                 $fnames[] = array("lastname", gT("Last name"), 'code' => 'lastname');
                 $fnames[] = array("email", gT("Email"), 'code' => 'email');
             }
         }
         $fnames[] = array("submitdate", gT("Completed"), gT("Completed"), "0", 'D');
         $fields = createFieldMap($iSurveyID, 'full', false, false, $aData['language']);
         foreach ($fields as $fielddetails) {
             if ($fielddetails['fieldname'] == 'lastpage' || $fielddetails['fieldname'] == 'submitdate') {
                 continue;
             }
             $question = $fielddetails['question'];
             if ($fielddetails['type'] != "|") {
                 if ($fielddetails['fieldname'] == 'lastpage' || $fielddetails['fieldname'] == 'submitdate' || $fielddetails['fieldname'] == 'token') {
                     continue;
                 }
                 // no headers for time data
                 if ($fielddetails['type'] == 'interview_time') {
                     continue;
                 }
                 if ($fielddetails['type'] == 'page_time') {
                     continue;
                 }
                 if ($fielddetails['type'] == 'answer_time') {
                     continue;
                 }
                 $fnames[] = array($fielddetails['fieldname'], viewHelper::getFieldText($fielddetails), 'code' => viewHelper::getFieldCode($fielddetails, array('LEMcompat' => true)));
             } elseif ($fielddetails['aid'] !== 'filecount') {
                 $qidattributes = getQuestionAttributeValues($fielddetails['qid']);
                 for ($i = 0; $i < $qidattributes['max_num_of_files']; $i++) {
                     $filenum = sprintf(gT("File %s"), $i + 1);
                     if ($qidattributes['show_title'] == 1) {
                         $fnames[] = array($fieldde 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP incompleteAnsFilterstate函数代码示例发布时间:2022-05-15
下一篇:
PHP includes_url函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap