当前位置: 首页>>代码示例>>PHP>>正文


PHP hasSurveyPermission函数代码示例

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


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

示例1: initKcfinder

function initKcfinder()
{
    Yii::app()->session['KCFINDER'] = array();
    $sAllowedExtensions = implode(' ', array_map('trim', explode(',', Yii::app()->getConfig('allowedresourcesuploads'))));
    $_SESSION['KCFINDER']['types'] = array('files' => $sAllowedExtensions, 'flash' => $sAllowedExtensions, 'images' => $sAllowedExtensions);
    if (Yii::app()->getConfig('demoMode') === false && isset(Yii::app()->session['loginID']) && isset(Yii::app()->session['FileManagerContext'])) {
        // disable upload at survey creation time
        // because we don't know the sid yet
        if (preg_match('/^(create|edit):(question|group|answer)/', Yii::app()->session['FileManagerContext']) != 0 || preg_match('/^edit:survey/', Yii::app()->session['FileManagerContext']) != 0 || preg_match('/^edit:assessments/', Yii::app()->session['FileManagerContext']) != 0 || preg_match('/^edit:emailsettings/', Yii::app()->session['FileManagerContext']) != 0) {
            $contextarray = explode(':', Yii::app()->session['FileManagerContext'], 3);
            $surveyid = $contextarray[2];
            if (hasSurveyPermission($surveyid, 'surveycontent', 'update')) {
                $_SESSION['KCFINDER']['disabled'] = false;
                if (preg_match('/^edit:emailsettings/', $_SESSION['FileManagerContext']) != 0) {
                    $_SESSION['KCFINDER']['uploadURL'] = Yii::app()->getRequest()->getHostInfo() . Yii::app()->getConfig('uploadurl') . "/surveys/{$surveyid}/";
                } else {
                    $_SESSION['KCFINDER']['uploadURL'] = Yii::app()->getConfig('uploadurl') . "/surveys/{$surveyid}/";
                }
                $_SESSION['KCFINDER']['uploadDir'] = Yii::app()->getConfig('uploaddir') . DIRECTORY_SEPARATOR . 'surveys' . DIRECTORY_SEPARATOR . $surveyid . DIRECTORY_SEPARATOR;
            }
        } elseif (preg_match('/^edit:label/', Yii::app()->session['FileManagerContext']) != 0) {
            $contextarray = explode(':', Yii::app()->session['FileManagerContext'], 3);
            $labelid = $contextarray[2];
            // check if the user has label management right and labelid defined
            if (Yii::app()->session['USER_RIGHT_MANAGE_LABEL'] == 1 && isset($labelid) && $labelid != '') {
                $_SESSION['KCFINDER']['disabled'] = false;
                $_SESSION['KCFINDER']['uploadURL'] = Yii::app()->getConfig('uploadurl') . "/labels/{$labelid}/";
                $_SESSION['KCFINDER']['uploadDir'] = Yii::app()->getConfig('uploaddir') . DIRECTORY_SEPARATOR . 'labels' . DIRECTORY_SEPARATOR . $labelid . DIRECTORY_SEPARATOR;
            }
        }
    }
}
开发者ID:ryu1inaba,项目名称:LimeSurvey,代码行数:32,代码来源:htmleditor_helper.php

示例2: update

 /**
  * Function responsible to process any change in email template.
  * @return
  */
 function update($iSurveyId)
 {
     $clang = $this->getController()->lang;
     if (hasSurveyPermission($iSurveyId, 'surveylocale', 'update')) {
         $languagelist = Survey::model()->findByPk($iSurveyId)->additionalLanguages;
         $languagelist[] = Survey::model()->findByPk($iSurveyId)->language;
         array_filter($languagelist);
         foreach ($languagelist as $langname) {
             $attributes = array('surveyls_email_invite_subj' => $_POST['email_invite_subj_' . $langname], 'surveyls_email_invite' => $_POST['email_invite_' . $langname], 'surveyls_email_remind_subj' => $_POST['email_remind_subj_' . $langname], 'surveyls_email_remind' => $_POST['email_remind_' . $langname], 'surveyls_email_register_subj' => $_POST['email_register_subj_' . $langname], 'surveyls_email_register' => $_POST['email_register_' . $langname], 'surveyls_email_confirm_subj' => $_POST['email_confirm_subj_' . $langname], 'surveyls_email_confirm' => $_POST['email_confirm_' . $langname], 'email_admin_notification_subj' => $_POST['email_admin_notification_subj_' . $langname], 'email_admin_notification' => $_POST['email_admin_notification_' . $langname], 'email_admin_responses_subj' => $_POST['email_admin_responses_subj_' . $langname], 'email_admin_responses' => $_POST['email_admin_responses_' . $langname]);
             $usquery = Surveys_languagesettings::model()->updateAll($attributes, 'surveyls_survey_id = :ssid AND surveyls_language = :sl', array(':ssid' => $iSurveyId, ':sl' => $langname));
         }
         Yii::app()->session['flashmessage'] = $clang->gT("Email templates successfully saved.");
     }
     $this->getController()->redirect($this->getController()->createUrl('admin/survey/view/surveyid/' . $iSurveyId));
 }
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:19,代码来源:emailtemplates.php

示例3: view

 public function view($iSurveyId)
 {
     $iSurveyId = sanitize_int($iSurveyId);
     $clang = $this->getController()->lang;
     $aViewUrls = array();
     if (!hasSurveyPermission($iSurveyId, 'responses', 'read')) {
         die;
     }
     $this->getController()->_js_admin_includes(Yii::app()->getConfig('generalscripts') . 'jquery/jquery.tablesorter.min.js');
     $this->getController()->_js_admin_includes(Yii::app()->getConfig('adminscripts') . 'saved.js');
     $aThisSurvey = getSurveyInfo($iSurveyId);
     $aData['sSurveyName'] = $aThisSurvey['name'];
     $aData['iSurveyId'] = $iSurveyId;
     $aViewUrls[] = 'savedbar_view';
     $aViewUrls['savedlist_view'][] = $this->_showSavedList($iSurveyId);
     $this->_renderWrappedTemplate('saved', $aViewUrls, $aData);
 }
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:17,代码来源:saved.php

示例4: 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

示例5: export_timeline

 /**
  * RPC Routine to export submission timeline.
  * Returns an array of values (count and period)
  *
  * @access public
  * @param string $sSessionKey Auth credentials
  * @param int $iSurveyID Id of the Survey
  * @param string $sType (day|hour)
  * @param string $dStart
  * @param string $dEnd
  * @return array On success: The timeline. On failure array with error information
  * */
 public function export_timeline($sSessionKey, $iSurveyID, $sType, $dStart, $dEnd)
 {
     if (!$this->_checkSessionKey($sSessionKey)) {
         return array('status' => 'Invalid session key');
     }
     if (!in_array($sType, array('day', 'hour'))) {
         return array('status' => 'Invalid Period');
     }
     if (!hasSurveyPermission($iSurveyID, 'responses', 'read')) {
         return array('status' => 'No permission');
     }
     $oSurvey = Survey::model()->findByPk($iSurveyID);
     if (is_null($oSurvey)) {
         return array('status' => 'Error: Invalid survey ID');
     }
     if (!tableExists('{{survey_' . $iSurveyID . '}}')) {
         return array('status' => 'No available data');
     }
     $oResponses = SurveyDynamic::model($iSurveyID)->timeline($sType, $dStart, $dEnd);
     if (empty($oResponses)) {
         return array('status' => 'No valid Data');
     }
     return $oResponses;
 }
开发者ID:kasutori,项目名称:LimeSurvey,代码行数:36,代码来源:remotecontrol_handle.php

示例6:

">
                    <img src='<?php 
    echo $imageurl;
    ?>
cpdb.png' alt='<?php 
    $clang->eT("Central participant database/panel");
    ?>
' />
                </a>
                <img src='<?php 
    echo $imageurl;
    ?>
separator.gif' class='separator' alt='' />
                <?php 
}
if (hasSurveyPermission($surveyid, 'surveyactivation', 'update') || HasSurveyPermission($surveyid, 'tokens', 'delete')) {
    ?>
                <a href="<?php 
    echo $this->createUrl("admin/tokens/sa/kill/surveyid/{$surveyid}");
    ?>
">
                    <img src='<?php 
    echo $imageurl;
    ?>
delete.png' alt='<?php 
    $clang->eT("Delete tokens table");
    ?>
' />
                </a>
                <?php 
}
开发者ID:ryu1inaba,项目名称:LimeSurvey,代码行数:31,代码来源:tokenbar.php

示例7:

    $clang->eT("Edit answer options for this question");
    ?>
' /></a>
            <?php 
} else {
    ?>
            <img src='<?php 
    echo $sImageURL;
    ?>
blank.gif' alt='' height="<?php 
    echo $iIconSize;
    ?>
" width='40' />
            <?php 
}
if (hasSurveyPermission($surveyid, 'surveycontent', 'read') && $qtypes[$qrrow['type']]['hasdefaultvalues'] > 0) {
    ?>
            <a href='<?php 
    echo $this->createUrl('admin/question/sa/editdefaultvalues/surveyid/' . $surveyid . '/gid/' . $gid . '/qid/' . $qid);
    ?>
'>
                <img src='<?php 
    echo $sImageURL;
    ?>
defaultanswers.png' alt='<?php 
    $clang->eT("Edit default answers for this question");
    ?>
' /></a>
            <?php 
}
?>
开发者ID:pmaonline,项目名称:limesurvey-quickstart,代码行数:31,代码来源:questionbar_view.php

示例8: _surveysummary


//.........这里部分代码省略.........
     }
     if ($surveyinfo['allowsave'] == "Y" && $surveyinfo['tokenanswerspersistence'] == 'N') {
         $surveysummary2 .= $clang->gT("Participants can save partially finished surveys") . "<br />\n";
     }
     if ($surveyinfo['emailnotificationto'] != '') {
         $surveysummary2 .= $clang->gT("Basic email notification is sent to:") . " {$surveyinfo['emailnotificationto']}<br />\n";
     }
     if ($surveyinfo['emailresponseto'] != '') {
         $surveysummary2 .= $clang->gT("Detailed email notification with response data is sent to:") . " {$surveyinfo['emailresponseto']}<br />\n";
     }
     $dateformatdetails = getDateFormatData(Yii::app()->session['dateformat']);
     if (trim($surveyinfo['startdate']) != '') {
         Yii::import('application.libraries.Date_Time_Converter');
         $datetimeobj = new Date_Time_Converter($surveyinfo['startdate'], 'Y-m-d H:i:s');
         $aData['startdate'] = $datetimeobj->convert($dateformatdetails['phpdate'] . ' H:i');
     } else {
         $aData['startdate'] = "-";
     }
     if (trim($surveyinfo['expires']) != '') {
         //$constructoritems = array($surveyinfo['expires'] , "Y-m-d H:i:s");
         Yii::import('application.libraries.Date_Time_Converter');
         $datetimeobj = new Date_Time_Converter($surveyinfo['expires'], 'Y-m-d H:i:s');
         //$datetimeobj = new Date_Time_Converter($surveyinfo['expires'] , "Y-m-d H:i:s");
         $aData['expdate'] = $datetimeobj->convert($dateformatdetails['phpdate'] . ' H:i');
     } else {
         $aData['expdate'] = "-";
     }
     if (!$surveyinfo['language']) {
         $aData['language'] = getLanguageNameFromCode($currentadminlang, false);
     } else {
         $aData['language'] = getLanguageNameFromCode($surveyinfo['language'], false);
     }
     // get the rowspan of the Additionnal languages row
     // is at least 1 even if no additionnal language is present
     $additionnalLanguagesCount = count($aAdditionalLanguages);
     $first = true;
     $aData['additionnalLanguages'] = "";
     if ($additionnalLanguagesCount == 0) {
         $aData['additionnalLanguages'] .= "<td>-</td>\n";
     } else {
         foreach ($aAdditionalLanguages as $langname) {
             if ($langname) {
                 if (!$first) {
                     $aData['additionnalLanguages'] .= "<tr><td>&nbsp;</td>";
                 }
                 $first = false;
                 $aData['additionnalLanguages'] .= "<td>" . getLanguageNameFromCode($langname, false) . "</td></tr>\n";
             }
         }
     }
     if ($first) {
         $aData['additionnalLanguages'] .= "</tr>";
     }
     if ($surveyinfo['surveyls_urldescription'] == "") {
         $surveyinfo['surveyls_urldescription'] = htmlspecialchars($surveyinfo['surveyls_url']);
     }
     if ($surveyinfo['surveyls_url'] != "") {
         $aData['endurl'] = " <a target='_blank' href=\"" . htmlspecialchars($surveyinfo['surveyls_url']) . "\" title=\"" . htmlspecialchars($surveyinfo['surveyls_url']) . "\">{$surveyinfo['surveyls_urldescription']}</a>";
     } else {
         $aData['endurl'] = "-";
     }
     $aData['sumcount3'] = $sumcount3;
     $aData['sumcount2'] = $sumcount2;
     if ($activated == "N") {
         $aData['activatedlang'] = $clang->gT("No");
     } else {
         $aData['activatedlang'] = $clang->gT("Yes");
     }
     $aData['activated'] = $activated;
     if ($activated == "Y") {
         $aData['surveydb'] = Yii::app()->db->tablePrefix . "survey_" . $iSurveyID;
     }
     $aData['warnings'] = "";
     if ($activated == "N" && $sumcount3 == 0) {
         $aData['warnings'] = $clang->gT("Survey cannot be activated yet.") . "<br />\n";
         if ($sumcount2 == 0 && hasSurveyPermission($iSurveyID, 'surveycontent', 'create')) {
             $aData['warnings'] .= "<span class='statusentryhighlight'>[" . $clang->gT("You need to add question groups") . "]</span><br />";
         }
         if ($sumcount3 == 0 && hasSurveyPermission($iSurveyID, 'surveycontent', 'create')) {
             $aData['warnings'] .= "<span class='statusentryhighlight'>[" . $clang->gT("You need to add questions") . "]</span><br />";
         }
     }
     $aData['hints'] = $surveysummary2;
     //return (array('column'=>array($columns_used,$hard_limit) , 'size' => array($length, $size_limit) ));
     //        $aData['tableusage'] = getDBTableUsage($iSurveyID);
     // ToDo: Table usage is calculated on every menu display which is too slow with bug surveys.
     // Needs to be moved to a database field and only updated if there are question/subquestions added/removed (it's currently also not functional due to the port)
     //
     $aData['tableusage'] = false;
     if ($gid || $action !== true && in_array($action, array('deactivate', 'activate', 'surveysecurity', 'editdefaultvalues', 'editemailtemplates', 'surveyrights', 'addsurveysecurity', 'addusergroupsurveysecurity', 'setsurveysecurity', 'setusergroupsurveysecurity', 'delsurveysecurity', 'editsurveysettings', 'editsurveylocalesettings', 'updatesurveysettingsandeditlocalesettings', 'addgroup', 'importgroup', 'ordergroups', 'deletesurvey', 'resetsurveylogic', 'importsurveyresources', 'translate', 'emailtemplates', 'exportstructure', 'quotas', 'copysurvey', 'viewgroup', 'viewquestion'))) {
         $showstyle = "style='display: none'";
     } else {
         $showstyle = "";
     }
     $aData['showstyle'] = $showstyle;
     $aData['aAdditionalLanguages'] = $aAdditionalLanguages;
     $aData['clang'] = $clang;
     $aData['surveyinfo'] = $surveyinfo;
     $this->getController()->render("/admin/survey/surveySummary_view", $aData);
 }
开发者ID:ryu1inaba,项目名称:LimeSurvey,代码行数:101,代码来源:Survey_Common_Action.php

示例9: elseif

            <a href='#'>
                <img src='<?php 
    echo $imageurl;
    ?>
add_disabled.png' title='' alt='<?php 
    echo $clang->gT("Disabled") . ' - ' . $clang->gT("This survey is currently active.");
    ?>
' width="<?php 
    echo $iIconSize;
    ?>
" height="<?php 
    echo $iIconSize;
    ?>
" /></a>
            <?php 
} elseif (hasSurveyPermission($surveyid, 'surveycontent', 'create')) {
    ?>
            <a href='<?php 
    echo $this->createUrl("admin/question/sa/addquestion/surveyid/" . $surveyid . "/gid/" . $gid);
    ?>
'>
                <img src='<?php 
    echo $imageurl;
    ?>
add.png' title='' alt='<?php 
    $clang->eT("Add new question to group");
    ?>
' width="<?php 
    echo $iIconSize;
    ?>
" height="<?php 
开发者ID:pmaonline,项目名称:limesurvey-quickstart,代码行数:31,代码来源:questiongroupbar_view.php

示例10: new_answer

 function new_answer($iSurveyId, $sSubAction = 'new_answer')
 {
     $iSurveyId = sanitize_int($iSurveyId);
     $this->_checkPermissions($iSurveyId, 'create');
     $aData = $this->_getData($iSurveyId);
     $sBaseLang = $aData['sBaseLang'];
     $clang = $aData['clang'];
     $aViewUrls = array();
     if (($sSubAction == "new_answer" || $sSubAction == "new_answer_two" && !isset($_POST['quota_qid'])) && hasSurveyPermission($iSurveyId, 'quotas', 'create')) {
         $result = Quota::model()->findAllByPk(Yii::app()->request->getPost('quota_id'));
         foreach ($result as $aQuotaDetails) {
             $quota_name = $aQuotaDetails['name'];
         }
         $result = Questions::model()->findAllByAttributes(array('type' => array('G', 'M', 'Y', 'A', 'B', 'I', 'L', 'O', '!'), 'sid' => $iSurveyId, 'language' => $sBaseLang, 'parent_qid' => 0));
         if (empty($result)) {
             $aViewUrls[] = 'newanswererror_view';
         } else {
             $aData['newanswer_result'] = $result;
             $aData['quota_name'] = $quota_name;
             $aViewUrls[] = 'newanswer_view';
         }
     }
     if ($sSubAction == "new_answer_two" && isset($_POST['quota_qid']) && hasSurveyPermission($iSurveyId, 'quotas', 'create')) {
         $aResults = Quota::model()->findByPk(Yii::app()->request->getPost('quota_qid'));
         $sQuotaName = $aResults['name'];
         $aQuestionAnswers = self::getQuotaAnswers(Yii::app()->request->getPost('quota_qid'), $iSurveyId, Yii::app()->request->getPost('quota_id'));
         $x = 0;
         foreach ($aQuestionAnswers as $aQACheck) {
             if (isset($aQACheck['rowexists'])) {
                 $x++;
             }
         }
         reset($aQuestionAnswers);
         $aData['question_answers'] = $aQuestionAnswers;
         $aData['x'] = $x;
         $aData['quota_name'] = $sQuotaName;
         $aViewUrls[] = 'newanswertwo_view';
     }
     $this->_renderWrappedTemplate('quotas', $aViewUrls, $aData);
 }
开发者ID:pmaonline,项目名称:limesurvey-quickstart,代码行数:40,代码来源:quotas.php

示例11: 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

示例12: loadSurveyResults

 /**
  * Loads results for the survey into the $survey->responses array.  The
  * results  begin from $minRecord and end with $maxRecord.  Either none,
  * or both,  the $minRecord and $maxRecord variables must be provided.
  * If none are then all responses are loaded.
  *
  * @param Survey $survey
  * @param int $iOffset 
  * @param int $iLimit 
  */
 public function loadSurveyResults(SurveyObj $survey, $iLimit, $iOffset, $iMaximum, $sFilter = '')
 {
     // Get info about the survey
     $aSelectFields = Yii::app()->db->schema->getTable('{{survey_' . $survey->id . '}}')->getColumnNames();
     $oRecordSet = Yii::app()->db->createCommand()->from('{{survey_' . $survey->id . '}}');
     if (tableExists('tokens_' . $survey->id) && array_key_exists('token', Survey_dynamic::model($survey->id)->attributes) && hasSurveyPermission($survey->id, 'tokens', 'read')) {
         $oRecordSet->leftJoin('{{tokens_' . $survey->id . '}} tokentable', 'tokentable.token={{survey_' . $survey->id . '}}.token');
         $aTokenFields = Yii::app()->db->schema->getTable('{{tokens_' . $survey->id . '}}')->getColumnNames();
         $aSelectFields = array_merge($aSelectFields, array_diff($aTokenFields, array('token')));
         $aSelectFields = array_diff($aSelectFields, array('token'));
         $aSelectFields[] = '{{survey_' . $survey->id . '}}.token';
     }
     if ($survey->info['savetimings'] == "Y") {
         $oRecordSet->leftJoin("{{survey_" . $survey->id . "_timings}} survey_timings", "{{survey_" . $survey->id . "}}.id = survey_timings.id");
         $aTimingFields = Yii::app()->db->schema->getTable("{{survey_" . $survey->id . "_timings}}")->getColumnNames();
         $aSelectFields = array_merge($aSelectFields, array_diff($aTimingFields, array('id')));
         $aSelectFields = array_diff($aSelectFields, array('id'));
         $aSelectFields[] = '{{survey_' . $survey->id . '}}.id';
     }
     if ($sFilter != '') {
         $oRecordSet->where($sFilter);
     }
     if ($iOffset + $iLimit > $iMaximum) {
         $iLimit = $iMaximum - $iOffset;
     }
     $survey->responses = $oRecordSet->select($aSelectFields)->order('{{survey_' . $survey->id . '}}.id')->limit($iLimit, $iOffset)->query()->readAll();
     return count($survey->responses);
 }
开发者ID:pmaonline,项目名称:limesurvey-quickstart,代码行数:38,代码来源:exportresults_helper.php

示例13: _newtokentable

 /**
  * Show dialogs and create a new tokens table
  */
 function _newtokentable($iSurveyId)
 {
     $clang = $this->getController()->lang;
     Yii::import('application.helpers.admin.token_helper', true);
     if (Yii::app()->request->getPost('createtable') == "Y" && hasSurveyPermission($iSurveyId, 'surveyactivation', 'update')) {
         createTokenTable($iSurveyId);
         $this->_renderWrappedTemplate('token', array('message' => array('title' => $clang->gT("Token control"), 'message' => $clang->gT("A token table has been created for this survey.") . " (\"" . Yii::app()->db->tablePrefix . "tokens_{$iSurveyId}\")<br /><br />\n" . "<input type='submit' value='" . $clang->gT("Continue") . "' onclick=\"window.open('" . $this->getController()->createUrl("admin/tokens/index/surveyid/{$iSurveyId}") . "', '_top')\" />\n")));
     } elseif (returnGlobal('restoretable') == "Y" && Yii::app()->request->getPost('oldtable') && hasSurveyPermission($iSurveyId, 'surveyactivation', 'update')) {
         //Rebuild attributedescription value for the surveys table
         $table = Yii::app()->db->schema->getTable(Yii::app()->request->getPost('oldtable'));
         $fields = array_filter(array_keys($table->columns), 'filterForAttributes');
         foreach ($fields as $fieldname) {
             $name = $fieldname;
             if ($fieldname[10] == 'c') {
                 //This belongs to a cpdb attribute
                 $cpdbattid = substr($fieldname, 15);
                 $data = ParticipantAttributeNames::model()->getAttributeName($cpdbattid, Yii::app()->session['adminlang']);
                 $name = $data['attribute_name'];
             }
             $fieldcontents[$fieldname] = array('description' => $name, 'mandatory' => 'N', 'show_register' => 'N');
         }
         Survey::model()->updateByPk($iSurveyId, array('attributedescriptions' => serialize($fieldcontents)));
         Yii::app()->db->createCommand()->renameTable(Yii::app()->request->getPost('oldtable'), Yii::app()->db->tablePrefix . "tokens_" . intval($iSurveyId));
         //Add any survey_links from the renamed table
         Survey_links::model()->rebuildLinksFromTokenTable($iSurveyId);
         $this->_renderWrappedTemplate('token', array('message' => array('title' => $clang->gT("Import old tokens"), 'message' => $clang->gT("A token table has been created for this survey and the old tokens were imported.") . " (\"" . Yii::app()->db->tablePrefix . "tokens_{$iSurveyId}" . "\")<br /><br />\n" . "<input type='submit' value='" . $clang->gT("Continue") . "' onclick=\"window.open('" . $this->getController()->createUrl("admin/tokens/index/surveyid/{$iSurveyId}") . "', '_top')\" />\n")));
         LimeExpressionManager::SetDirtyFlag();
         // so that knows that token tables have changed
     } else {
         $this->getController()->loadHelper('database');
         $result = Yii::app()->db->createCommand(dbSelectTablesLike("{{old_tokens_" . intval($iSurveyId) . "_%}}"))->queryAll();
         $tcount = count($result);
         if ($tcount > 0) {
             foreach ($result as $rows) {
                 $oldlist[] = reset($rows);
             }
             $aData['oldlist'] = $oldlist;
         }
         $thissurvey = getSurveyInfo($iSurveyId);
         $aData['thissurvey'] = $thissurvey;
         $aData['surveyid'] = $iSurveyId;
         $aData['tcount'] = $tcount;
         $aData['databasetype'] = Yii::app()->db->getDriverName();
         $this->_renderWrappedTemplate('token', 'tokenwarning', $aData);
     }
 }
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:49,代码来源:tokens.php

示例14: 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' && hasSurveyPermission($iSurveyID, 'responses', 'delete')) {
         $iResponseID = (int) Yii::app()->request->getPost('deleteanswer');
         Survey_dynamic::model($iSurveyID)->deleteByPk($iResponseID);
         Survey_timings::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' && hasSurveyPermission($iSurveyID, 'responses', 'delete')) {
             foreach (Yii::app()->request->getPost('markedresponses') as $iResponseID) {
                 $iResponseID = (int) $iResponseID;
                 Survey_dynamic::model($iSurveyID)->deleteByPk($iResponseID);
                 Survey_timings::model($iSurveyID)->deleteByPk($iResponseID);
             }
         }
     }
     $fields = createTimingsFieldMap($iSurveyID, 'full', true, false, $aData['language']);
     $clang = $aData['clang'];
     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'], $clang->gT('Total time'));
         }
         if ($fielddetails['type'] == 'page_time') {
             $fnames[] = array($fielddetails['fieldname'], $clang->gT('Group') . ": " . $fielddetails['group_name']);
         }
         if ($fielddetails['type'] == 'answer_time') {
             $fnames[] = array($fielddetails['fieldname'], $clang->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 = Survey_timings::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 = Survey_timings::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;
//.........这里部分代码省略.........
开发者ID:ryu1inaba,项目名称:LimeSurvey,代码行数:101,代码来源:responses.php

示例15: stripslashes

<?php } else { ?>
	<td><?php $clang->eT("Question group");?></td>
	<td><?php echo $groups[$assess['gid']]." (".$assess['gid'].")";?></td>
<?php } ?>


<td><?php echo $assess['minimum'];?></td>
<td><?php echo $assess['maximum'];?></td>
<td><?php echo stripslashes($assess['name']);?></td>
<td><?php echo strip_tags(stripJavaScript($assess['message']));?></td>

</tr>
<?php } ?>
</tbody></table>

<?php if ((hasSurveyPermission($surveyid, 'assessments','update') && $actionvalue=="assessmentupdate") || (hasSurveyPermission($surveyid, 'assessments','create')&& $actionvalue=="assessmentadd")) { ?>
<br /><form method='post' class='form30' id='assessmentsform' name='assessmentsform' action='<?php echo $this->createUrl("admin/assessments/index/surveyid/$surveyid");?>'>
	<div class='header ui-widget-header'><?php echo $actiontitle;?></div>
	<ul class="assessmentscope"><li><label><?php $clang->eT("Scope");?></label>
	<input type='radio' id='radiototal' name='scope' value='T' <?php
    if (!isset($editdata) || $editdata['scope'] == "T") {echo "checked='checked' ";} ?>/>
    <label for='radiototal'><?php $clang->eT("Total");?></label>
    <input type='radio' id='radiogroup' name='scope' value='G' <?php
    if (isset($editdata) && $editdata['scope'] == "G") {echo " checked='checked' ";} ?>/>
    <label for='radiogroup'><?php $clang->eT("Group");?></label></li>
    <li><label for='gid'><?php $clang->eT("Question group");?></label>
        <?php 
        if (isset($groups))
        { ?>
	        <select name='gid' id='gid'>
	            <?php
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:31,代码来源:assessments_view.php


注:本文中的hasSurveyPermission函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。