<div class='header ui-widget-header'> <strong><?php printf(ngT("Select which fields to import as attributes with your participant.","Select which fields to import as attributes with your %s participants.",$linecount), $linecount); ?></strong> </div> <div class="draggable-container"> <div id="csvattribute" class="attribute-column"> <div class="heading"><?php eT("CSV field names "); ?></div> <div class='instructions'><?php eT("The following additional fields were found in your CSV file."); ?></div> <div class="csvatt droppable"> <?php foreach ($firstline as $key => $value) { echo "<div id='cs_" . $value . "' data-name='" . $value . "' class=\"csv-attribute attribute-item draggable\">" . $value . "</div>"; } ?> </div> </div> <div id="newcreated" class="attribute-column"> <div class="heading"><?php eT("Attributes to be created") ?></div> <div class='instructions'><?php eT("Drop a CSV field into this area to create a new participant attribute and import your data into it."); ?></div> <div class="newcreate droppable" style ="height: 40px"> </div> </div> <div id="centralattribute" class="attribute-column"> <div class="heading"><?php eT("Existing attribute"); ?></div> <div class='instructions'><?php eT("Drop a CSV field into an existing participant attribute listed below to import your data into it."); ?></div> <div class="centralatt"> <?php foreach ($attributes as $key => $value) { echo "<div class=\"mappable-attribute-wrapper droppable\"><div id='c_" . $value['attribute_id'] . "' data-name='c_" . $key . "' class=\"mappable-attribute attribute-item\">" . $value['attribute_name'] . "</div></div>"; }
<div class='header ui-widget-header'> <strong><?php printf(ngT("Select which fields to import as attributes with your participant.|Select which fields to import as attributes with your %s participants.", $linecount), $linecount); ?> </strong> </div> <div class="draggable-container"> <div id="csvattribute" class="attribute-column"> <div class="heading"><?php eT("CSV field names "); ?> </div> <div class='instructions'><?php eT("The following additional fields were found in your CSV file."); ?> </div> <div class="csvatt droppable"> <?php foreach ($firstline as $key => $value) { echo "<div id='cs_" . $value . "' data-name='" . $value . "' class=\"csv-attribute attribute-item draggable\">" . $value . "</div>"; } ?> </div> </div> <div id="newcreated" class="attribute-column"> <div class="heading"><?php eT("Attributes to be created"); ?> </div> <div class='instructions'><?php eT("Drop a CSV field into this area to create a new participant attribute and import your data into it.");
private function ngT($sTextToTranslate, $number, $escapemode = 'html') { return ngT($sTextToTranslate, $number, $escapemode); }
eT("Edit your personal preferences"); ?> ' /></a> </strong> <?php } ?> </div> <?php if ($showupdate) { ?> <div class='menubar-title-right'><a href='<?php echo $this->createUrl("admin/globalsettings"); ?> '><?php echo sprintf(ngT('Update available: %s|Updates available: %s', count($aUpdateVersions)), $sUpdateText); ?> </a></div> <?php } ?> </div> <div class='menubar-main'> <div class='menubar-left'> <a href="<?php echo $this->createUrl("/admin/survey/sa/index"); ?> "> <img src='<?php echo $sImageURL; ?>
function browse($iSurveyID) { $aData = $this->_getData($iSurveyID); extract($aData); $aViewUrls = array(); $oBrowseLanguage = new Limesurvey_lang($aData['language']); $tokenRequest = Yii::app()->request->getParam('token', null); //Delete Individual answer using inrow delete buttons/links - checked if (Yii::app()->request->getPost('deleteanswer') && Yii::app()->request->getPost('deleteanswer') != '' && Yii::app()->request->getPost('deleteanswer') != 'marked') { if (Permission::model()->hasSurveyPermission($iSurveyID, 'responses', 'delete')) { $iResponseID = (int) Yii::app()->request->getPost('deleteanswer'); // sanitize the value Response::model($iSurveyID)->findByPk($iResponseID)->delete(true); // delete timings if savetimings is set if ($aData['surveyinfo']['savetimings'] == "Y") { SurveyTimingDynamic::model($iSurveyID)->deleteByPk($iResponseID); } Yii::app()->session['flashmessage'] = sprintf(gT("Response ID %s was successfully deleted."), $iResponseID); } else { Yii::app()->session['flashmessage'] = gT("Access denied!", 'js'); } } // Marked responses -> deal with the whole batch of marked responses if (Yii::app()->request->getPost('markedresponses') && count(Yii::app()->request->getPost('markedresponses')) > 0) { // Delete the marked responses - checked if (Yii::app()->request->getPost('deleteanswer') && Yii::app()->request->getPost('deleteanswer') === 'marked') { if (Permission::model()->hasSurveyPermission($iSurveyID, 'responses', 'delete')) { foreach (Response::model($iSurveyID)->findAllByPk(Yii::app()->request->getPost('markedresponses')) as $response) { $response->deleteFiles(); // delete timings if savetimings is set /** * @todo Move this to the Response model. */ if ($aData['surveyinfo']['savetimings'] == "Y") { SurveyTimingDynamic::model($iSurveyID)->deleteByPk($iResponseID); } } Response::model($iSurveyID)->deleteByPk(Yii::app()->request->getPost('markedresponses')); Yii::app()->session['flashmessage'] = sprintf(ngT("%s response was successfully deleted.", "%s responses were successfully deleted.", count(Yii::app()->request->getPost('markedresponses'))), count(Yii::app()->request->getPost('markedresponses')), 'js'); } else { Yii::app()->session['flashmessage'] = $clang->gT("Access denied!", 'js'); } } elseif (Yii::app()->request->getPost('downloadfile') && Yii::app()->request->getPost('downloadfile') === 'marked') { if (Permission::model()->hasSurveyPermission($iSurveyID, 'responses', 'read')) { // Now, zip all the files in the filelist $zipfilename = "Responses_for_survey_{$iSurveyID}.zip"; $this->_zipFiles($iSurveyID, Yii::app()->request->getPost('markedresponses'), $zipfilename); } } } elseif (Yii::app()->request->getPost('downloadfile') && Yii::app()->request->getPost('downloadfile') != '' && Yii::app()->request->getPost('downloadfile') !== true) { if (Permission::model()->hasSurveyPermission($iSurveyID, 'responses', 'read')) { // Now, zip all the files in the filelist $zipfilename = "Files_for_responses_" . Yii::app()->request->getPost('downloadfile') . ".zip"; $this->_zipFiles($iSurveyID, Yii::app()->request->getPost('downloadfile'), $zipfilename); } } elseif (Yii::app()->request->getParam('downloadindividualfile') != '') { if (Permission::model()->hasSurveyPermission($iSurveyID, 'responses', 'read')) { $iId = (int) Yii::app()->request->getParam('id'); $downloadindividualfile = Yii::app()->request->getParam('downloadindividualfile'); $fieldname = Yii::app()->request->getParam('fieldname'); $oRow = SurveyDynamic::model($iSurveyID)->findByAttributes(array('id' => $iId)); $phparray = json_decode_ls($oRow->{$fieldname}); for ($i = 0; $i < count($phparray); $i++) { if (rawurldecode($phparray[$i]['name']) == rawurldecode($downloadindividualfile)) { $file = Yii::app()->getConfig('uploaddir') . "/surveys/" . $iSurveyID . "/files/" . $phparray[$i]['filename']; if (file_exists($file)) { @ob_clean(); header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . rawurldecode($phparray[$i]['name']) . '"'); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize($file)); readfile($file); exit; } else { Yii::app()->session['flashmessage'] = gT("The requested file does not exist on the server."); } break; } } } } /** * 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", $clang->gT("Token ID"), 'code' => 'token'); $fnames[] = array("firstname", $clang->gT("First name"), 'code' => 'firstname'); // or token:firstname ? $fnames[] = array("lastname", $clang->gT("Last name"), 'code' => 'lastname'); $fnames[] = array("email", $clang->gT("Email"), 'code' => 'email'); } } $fnames[] = array("submitdate", $clang->gT("Completed"), $clang->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($clang->gT("File %s"), $i + 1); if ($qidattributes['show_title'] == 1) { $fnames[] = array($fielddetails['fieldname'], "{$filenum} - {$question} (" . $clang->gT('Title') . ")", 'code' => viewHelper::getFieldCode($fielddetails) . '(title)', "type" => "|", "metadata" => "title", "index" => $i); } if ($qidattributes['show_comment'] == 1) { $fnames[] = array($fielddetails['fieldname'], "{$filenum} - {$question} (" . $clang->gT('Comment') . ")", 'code' => viewHelper::getFieldCode($fielddetails) . '(comment)', "type" => "|", "metadata" => "comment", "index" => $i); } $fnames[] = array($fielddetails['fieldname'], "{$filenum} - {$question} (" . $clang->gT('File name') . ")", 'code' => viewHelper::getFieldCode($fielddetails) . '(name)', "type" => "|", "metadata" => "name", "index" => $i); $fnames[] = array($fielddetails['fieldname'], "{$filenum} - {$question} (" . $clang->gT('File size') . ")", 'code' => viewHelper::getFieldCode($fielddetails) . '(size)', "type" => "|", "metadata" => "size", "index" => $i); //$fnames[] = array($fielddetails['fieldname'], "File ".($i+1)." - ".$fielddetails['question']."(extension)", "type"=>"|", "metadata"=>"ext", "index"=>$i); } } else { $fnames[] = array($fielddetails['fieldname'], $clang->gT("File count"), 'code' => viewHelper::getFieldCode($fielddetails)); } } $fncount = count($fnames); $start = (int) Yii::app()->request->getParam('start', 0); $limit = (int) Yii::app()->request->getParam('limit', 50); $order = Yii::app()->request->getParam('order', 'asc'); if (!$limit) { $limit = 50; } $oCriteria = new CDbCriteria(); //Create the query if ($aData['surveyinfo']['anonymized'] == "N" && tableExists("{{tokens_{$iSurveyID}}}") && Permission::model()->hasSurveyPermission($iSurveyID, 'tokens', 'read')) { $oCriteria = SurveyDynamic::model($iSurveyID)->addTokenCriteria($oCriteria); } if (incompleteAnsFilterState() == "incomplete") { $oCriteria->addCondition("submitdate IS NULL"); } elseif (incompleteAnsFilterState() == "complete") { $oCriteria->addCondition("submitdate IS NOT NULL"); } $dtcount = SurveyDynamic::model($iSurveyID)->count($oCriteria); // or die("Couldn't get response data<br />"); if ($limit > $dtcount) { $limit = $dtcount; } //NOW LETS SHOW THE DATA if (Yii::app()->request->getPost('sql') && stripcslashes(Yii::app()->request->getPost('sql')) !== "" && Yii::app()->request->getPost('sql') != "NULL") { $oCriteria->addCondition(stripcslashes(Yii::app()->request->getPost('sql'))); } if (!is_null($tokenRequest)) { $oCriteria->addCondition('t.token = ' . Yii::app()->db->quoteValue($tokenRequest)); } $oCriteria->order = 'id ' . ($order == 'desc' ? 'desc' : 'asc'); $oCriteria->offset = $start; $oCriteria->limit = $limit; $dtresult = SurveyDynamic::model($iSurveyID)->findAllAsArray($oCriteria); $dtcount2 = count($dtresult); $cells = $fncount + 1; // Fix start if order is desc, only if actual start is 0 if ($order == 'desc' && $start == 0) { $start = $dtcount - count($dtresult); } //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['dtcount2'] = $dtcount2; $aData['sCompletionStateValue'] = incompleteAnsFilterState(); $aData['start'] = $start; $aData['limit'] = $limit; $aData['last'] = $last; $aData['next'] = $next; $aData['end'] = $end; $aData['fncount'] = $fncount; $aData['fnames'] = $fnames; $aData['bHasFileUploadQuestion'] = hasFileUploadQuestion($iSurveyID); $aViewUrls[] = 'browseallheader_view'; $bgcc = 'even'; foreach ($dtresult as $dtrow) { if ($bgcc == "even") { $bgcc = "odd"; } else { $bgcc = "even"; } $aData['dtrow'] = $dtrow; $aData['bgcc'] = $bgcc; $aData['oBrowseLanguage'] = $oBrowseLanguage; $aViewUrls['browseallrow_view'][] = $aData; } $aViewUrls[] = 'browseallfooter_view'; $this->_renderWrappedTemplate('', $aViewUrls, $aData); } else { $clang = $this->getController()->lang; $aData['surveyid'] = $iSurveyID; App()->getClientScript()->registerPackage('jquery-superfish'); $message['title'] = $clang->gT('Access denied!'); $message['message'] = $clang->gT('You do not have sufficient rights to access this page.'); $message['class'] = "error"; $this->_renderWrappedTemplate('survey', array("message" => $message), $aData); } }
function do_file_upload($ia) { global $thissurvey; $checkconditionFunction = "checkconditions"; $aQuestionAttributes = QuestionAttribute::model()->getQuestionAttributes($ia[0]); // Fetch question attributes $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['fieldname'] = $ia[1]; $scriptloc = Yii::app()->getController()->createUrl('uploader/index'); $bPreview = Yii::app()->request->getParam('action') == "previewgroup" || Yii::app()->request->getParam('action') == "previewquestion" || $thissurvey['active'] != "Y"; if ($bPreview) { $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['preview'] = 1; $questgrppreview = 1; // Preview is launched from Question or group level } elseif ($thissurvey['active'] != "Y") { $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['preview'] = 1; $questgrppreview = 0; } else { $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['preview'] = 0; $questgrppreview = 0; } $answer = "<script type='text/javascript'>\n function upload_{$ia['1']}() {\n var uploadurl = '{$scriptloc}?sid=" . Yii::app()->getConfig('surveyID') . "&fieldname={$ia[1]}&qid={$ia[0]}';\n uploadurl += '&preview={$questgrppreview}&show_title={$aQuestionAttributes['show_title']}';\n uploadurl += '&show_comment={$aQuestionAttributes['show_comment']}';\n uploadurl += '&minfiles=' + LEMval('{$aQuestionAttributes['min_num_of_files']}');\n uploadurl += '&maxfiles=' + LEMval('{$aQuestionAttributes['max_num_of_files']}');\n \$('#upload_{$ia['1']}').attr('href',uploadurl);\n }\n var uploadLang = {\n title: '" . gT('Upload your files', 'js') . "',\n returnTxt: '" . gT('Return to survey', 'js') . "',\n headTitle: '" . gT('Title', 'js') . "',\n headComment: '" . gT('Comment', 'js') . "',\n headFileName: '" . gT('File name', 'js') . "',\n deleteFile : '" . gT('Delete') . "',\n editFile : '" . gT('Edit') . "'\n };\n var imageurl = '" . Yii::app()->getConfig('imageurl') . "';\n var uploadurl = '" . $scriptloc . "';\n </script>\n"; Yii::app()->getClientScript()->registerScriptFile(Yii::app()->getConfig('generalscripts') . "modaldialog.js"); Yii::app()->getClientScript()->registerCssFile(Yii::app()->getConfig('publicstyleurl') . "uploader-files.css"); // Modal dialog //$answer .= $uploadbutton; $filecountvalue = '0'; if (array_key_exists($ia[1] . "_filecount", $_SESSION['survey_' . Yii::app()->getConfig('surveyID')])) { $tempval = $_SESSION['survey_' . Yii::app()->getConfig('surveyID')][$ia[1] . "_filecount"]; if (is_numeric($tempval)) { $filecountvalue = $tempval; } } $value = htmlspecialchars($_SESSION['survey_' . Yii::app()->getConfig('surveyID')][$ia[1]], ENT_QUOTES, 'utf-8'); $fileuploadDatas = array('fileid' => $ia[1], 'value' => $value, 'filecountvalue' => $filecountvalue); $answer .= doRender('/survey/questions/file_upload/answer', $fileuploadDatas, true); $answer .= '<script type="text/javascript"> var surveyid = ' . Yii::app()->getConfig('surveyID') . '; $(document).ready(function(){ var fieldname = "' . $ia[1] . '"; var filecount = $("#"+fieldname+"_filecount").val(); var json = $("#"+fieldname).val(); var show_title = "' . $aQuestionAttributes["show_title"] . '"; var show_comment = "' . $aQuestionAttributes["show_comment"] . '"; displayUploadedFiles(json, filecount, fieldname, show_title, show_comment); }); </script>'; $answer .= '<script type="text/javascript"> $(".basic_' . $ia[1] . '").change(function() { var i; var jsonstring = "["; for (i = 1, filecount = 0; i <= LEMval("' . $aQuestionAttributes['max_num_of_files'] . '"); i++) { if ($("#' . $ia[1] . '_"+i).val() == "") continue; filecount++; if (i != 1) jsonstring += ", "; if ($("#answer' . $ia[1] . '_"+i).val() != "") jsonstring += "{ '; if (isset($_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['show_title'])) { $answer .= '\\"title\\":\\""+$("#' . $ia[1] . '_title_"+i).val()+"\\",'; } else { $answer .= '\\"title\\":\\"\\",'; } if (isset($_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['show_comment'])) { $answer .= '\\"comment\\":\\""+$("#' . $ia[1] . '_comment_"+i).val()+"\\",'; } else { $answer .= '\\"comment\\":\\"\\",'; } $answer .= '\\"size\\":\\"\\",\\"name\\":\\"\\",\\"ext\\":\\"\\"}"; } jsonstring += "]"; $("#' . $ia[1] . '").val(jsonstring); $("#' . $ia[1] . '_filecount").val(filecount); }); </script>'; $uploadurl = $scriptloc . "?sid=" . Yii::app()->getConfig('surveyID') . "&fieldname=" . $ia[1] . "&qid=" . $ia[0]; $uploadurl .= "&preview=" . $questgrppreview . "&show_title=" . $aQuestionAttributes['show_title']; $uploadurl .= "&show_comment=" . $aQuestionAttributes['show_comment']; $uploadurl .= "&minfiles=" . $aQuestionAttributes['min_num_of_files']; // TODO: Regression here? Should use LEMval(minfiles) like above $uploadurl .= "&maxfiles=" . $aQuestionAttributes['max_num_of_files']; // Same here. $answer .= ' <!-- Trigger the modal with a button --> <!-- <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>--> <!-- Modal --> <div id="file-upload-modal-' . $ia[1] . '" class="modal fade" role="dialog"> <div class="modal-dialog"> <!-- Modal content--> <div class="modal-content" style="vertical-align: middle;"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title">' . ngT("Upload file|Upload files", $aQuestionAttributes['max_num_of_files']) . '</h4> </div> <div class="modal-body file-upload-modal-body"> <iframe id="uploader' . $ia[1] . '" name="uploader' . $ia[1] . '" class="externalSite" src="' . $uploadurl . '"></iframe> </div> <div class="modal-footer file-upload-modal-footer"> <button type="button" class="btn btn-success" data-dismiss="modal">' . gT("Save changes") . '</button> </div> </div> </div> </div> '; $inputnames[] = $ia[1]; $inputnames[] = $ia[1] . "_filecount"; return array($answer, $inputnames); }
<p> <input type="submit" class="btn btn-default" value="<?php eT('Save'); ?>" /> <input type='hidden' name='action' value='tokens' /> <input type='hidden' name='subaction' value='updatetokenattributedescriptions' /> </p> </form> </div> </div> <?php endif; ?> <h3><?php eT("Add or delete token attributes"); ?></h3> <div class="row"> <div class="col-lg-12 content-right"> <p><?php echo sprintf(ngT('There is %s user attribute field in this token table.","There are %s user attribute fields in this token table.', $nrofattributes), $nrofattributes); ?></p> <?php echo CHtml::form(array("admin/tokens/sa/updatetokenattributes/surveyid/{$surveyid}"), 'post',array('id'=>'addattribute')); ?> <p> <label for="addnumber"><?php eT('Number of attribute fields to add:'); ?></label> <div class='col-sm-1'> <input class='form-control' type="text" id="addnumber" name="addnumber" size="3" maxlength="3" value="1" /> </div> </p> <p> <?php echo CHtml::submitButton(gT('Add fields','unescaped'), array('class'=>'btn btn-default')); ?> <?php echo CHtml::hiddenField('action','tokens'); ?> <?php echo CHtml::hiddenField('subaction','updatetokenattributes'); ?> <?php echo CHtml::hiddenField('sid',$surveyid); ?> </p> <?php echo CHtml::endForm() ?> <?php if( count($tokenfieldlist)) { ?>
<li class="divider"></li> <!-- Logout --> <li> <a href="<?php echo $this->createUrl("admin/authentication/sa/logout"); ?>"> <?php eT("Logout");?> </a> </li> </ul> </li> <!-- active surveys --> <?php if ($activesurveyscount > 0): ?> <li> <a href="<?php echo $this->createUrl('admin/survey/sa/listsurveys/active/Y');?>"> <?php printf(ngT("%s active survey","%s active surveys",$activesurveyscount),$activesurveyscount); ?> </a> </li> <?php endif;?> <?php if($showupdate): ?> <li class=""> <a href="#notifications"> <?php if($showupdate): ?> <span class=" label update-small-notification <?php if(Yii::app()->session['notificationstate']=='1' || Yii::app()->session['unstable_update'] ){echo 'hidden';};?>" >1</span> <?php endif;?> <i class="nav-icon fa fa-bullhorn"></i> </a> <!-- NOTIFICATIONS --> <?php if($showupdate): ?>
</div> </div> <?php } ?> <h3><?php eT("Add or delete token attributes"); ?> </h3> <div class="row"> <div class="col-lg-12 content-right"> <p><?php echo sprintf(ngT('There is %s user attribute field in this token table.|There are %s user attribute fields in this token table.', $nrofattributes), $nrofattributes); ?> </p> <?php echo CHtml::form(array("admin/tokens/sa/updatetokenattributes/surveyid/{$surveyid}"), 'post', array('id' => 'addattribute')); ?> <p> <label for="addnumber"><?php eT('Number of attribute fields to add:'); ?> </label> <div class='col-sm-1'> <input class='form-control' type="text" id="addnumber" name="addnumber" size="3" maxlength="3" value="1" /> </div> </p> <p>
/** * Generate tokens */ public function tokenify($iSurveyId) { $iSurveyId = sanitize_int($iSurveyId); if (!Permission::model()->hasSurveyPermission($iSurveyId, 'tokens', 'update')) { Yii::app()->session['flashmessage'] = gT("You do not have permission to access this page."); $this->getController()->redirect(array("/admin/survey/sa/view/surveyid/{$iSurveyId}")); } // CHECK TO SEE IF A TOKEN TABLE EXISTS FOR THIS SURVEY $bTokenExists = tableExists('{{tokens_' . $iSurveyId . '}}'); if (!$bTokenExists) { self::_newtokentable($iSurveyId); } $aData['thissurvey'] = getSurveyInfo($iSurveyId); $aData['surveyid'] = $iSurveyId; $surveyinfo = Survey::model()->findByPk($iSurveyId)->surveyinfo; $aData['sidemenu']['state'] = false; $aData["surveyinfo"] = $surveyinfo; $aData['title_bar']['title'] = $surveyinfo['surveyls_title'] . "(" . gT("ID") . ":" . $iSurveyId . ")"; $aData['sidemenu']["token_menu"] = TRUE; if (!Yii::app()->request->getParam('ok')) { $aData['sidemenu']['state'] = false; $this->_renderWrappedTemplate('token', array('message' => array('title' => gT("Create tokens"), 'message' => gT("Clicking 'Yes' will generate tokens for all those in this token list that have not been issued one. Continue?") . "<br /><br />\n" . "<input class='btn btn-default btn-lg' type='submit' value='" . gT("Yes") . "' onclick=\"" . convertGETtoPOST($this->getController()->createUrl("admin/tokens/sa/tokenify/surveyid/{$iSurveyId}", array('ok' => 'Y'))) . "\" />\n" . "<input class='btn btn-default btn-lg' type='submit' value='" . gT("No") . "' onclick=\"window.open('" . $this->getController()->createUrl("admin/tokens/sa/index/surveyid/{$iSurveyId}") . "', '_top')\" />\n" . "<br />\n")), $aData); } else { //get token length from survey settings $newtoken = Token::model($iSurveyId)->generateTokens($iSurveyId); $newtokencount = $newtoken['0']; $neededtokencount = $newtoken['1']; if ($neededtokencount > $newtokencount) { $aData['success'] = false; $message = ngT('Only {n} token has been created.|Only {n} tokens have been created.', $newtokencount) . ngT('Need {n} token.|Need {n} tokens.', $neededtokencount); $message .= '<p><a href="' . App()->createUrl('admin/tokens/sa/index/surveyid/' . $iSurveyId) . '" title="" class="btn btn-default btn-lg">' . gT("Ok") . '</a></p>'; } else { $aData['success'] = true; $message = ngT('{n} token has been created.|{n} tokens have been created.', $newtokencount); $message .= '<p><a href="' . App()->createUrl('admin/tokens/sa/index/surveyid/' . $iSurveyId) . '" title="" class="btn btn-default btn-lg">' . gT("Ok") . '</a></p>'; } $this->_renderWrappedTemplate('token', array('message' => array('title' => gT("Create tokens"), 'message' => $message)), $aData); } }
/** * Generate tokens */ function tokenify($iSurveyId) { $iSurveyId = sanitize_int($iSurveyId); if (!Permission::model()->hasSurveyPermission($iSurveyId, 'tokens', 'update')) { Yii::app()->session['flashmessage'] = gT("You do not have sufficient rights to access this page."); $this->getController()->redirect(array("/admin/survey/sa/view/surveyid/{$iSurveyId}")); } // CHECK TO SEE IF A TOKEN TABLE EXISTS FOR THIS SURVEY $bTokenExists = tableExists('{{tokens_' . $iSurveyId . '}}'); if (!$bTokenExists) { self::_newtokentable($iSurveyId); } $aData['thissurvey'] = getSurveyInfo($iSurveyId); $aData['surveyid'] = $iSurveyId; if (!Yii::app()->request->getParam('ok')) { $this->_renderWrappedTemplate('token', array('tokenbar', 'message' => array('title' => gT("Create tokens"), 'message' => gT("Clicking 'Yes' will generate tokens for all those in this token list that have not been issued one. Continue?") . "<br /><br />\n" . "<input type='submit' value='" . gT("Yes") . "' onclick=\"" . convertGETtoPOST($this->getController()->createUrl("admin/tokens/sa/tokenify/surveyid/{$iSurveyId}", array('ok' => 'Y'))) . "\" />\n" . "<input type='submit' value='" . gT("No") . "' onclick=\"window.open('" . $this->getController()->createUrl("admin/tokens/sa/index/surveyid/{$iSurveyId}") . "', '_top')\" />\n" . "<br />\n")), $aData); } else { //get token length from survey settings $newtoken = Token::model($iSurveyId)->generateTokens($iSurveyId); $newtokencount = $newtoken['0']; $neededtokencount = $newtoken['1']; if ($neededtokencount > $newtokencount) { $aData['success'] = false; $message = sprintf(ngT('Only %s token has been created.|Only %s tokens have been created.', $newtokencount), $newtokencount) . sprintf(ngT('Need %s token.|Need %s tokens.', $neededtokencount), $neededtokencount); } else { $aData['success'] = true; $message = sprintf(ngT('%s token has been created.|%s tokens have been created.', $newtokencount), $newtokencount); } $this->_renderWrappedTemplate('token', array('tokenbar', 'message' => array('title' => gT("Create tokens"), 'message' => $message)), $aData); } }
/** * Run a registered function * Some PHP functions require specific data types - those can be cast here. * @param <type> $funcNameToken * @param <type> $params * @return boolean */ private function RDP_RunFunction($funcNameToken, $params) { $name = $funcNameToken[0]; if (!$this->RDP_isValidFunction($name)) { return false; } $func = $this->RDP_ValidFunctions[$name]; $funcName = $func[0]; $numArgs = count($params); $result = 1; // default value for $this->RDP_onlyparse if (function_exists($funcName)) { $numArgsAllowed = array_slice($func, 5); // get array of allowable argument counts from end of $func $argsPassed = is_array($params) ? count($params) : 0; // for unlimited # parameters (any value less than 0). try { if ($numArgsAllowed[0] < 0) { $minArgs = abs($numArgsAllowed[0] + 1); // so if value is -2, means that requires at least one argument if ($argsPassed < $minArgs) { $this->RDP_AddError(sprintf(ngT("Function must have at least %s argument", "Function must have at least %s arguments", $minArgs), $minArgs), $funcNameToken); return false; } if (!$this->RDP_onlyparse) { switch ($funcName) { case 'sprintf': // PHP doesn't let you pass array of parameters to function, so must use call_user_func_array $result = call_user_func_array('sprintf', $params); break; default: $result = $funcName($params); break; } } // Call function with the params passed } elseif (in_array($argsPassed, $numArgsAllowed)) { switch ($argsPassed) { case 0: if (!$this->RDP_onlyparse) { $result = $funcName(); } break; case 1: if (!$this->RDP_onlyparse) { switch ($funcName) { case 'acos': case 'asin': case 'atan': case 'cos': case 'exp': case 'is_nan': case 'sin': case 'sqrt': case 'tan': if (is_numeric($params[0])) { $result = $funcName(floatval($params[0])); } else { $result = NAN; } break; default: $result = $funcName($params[0]); break; } } break; case 2: if (!$this->RDP_onlyparse) { switch ($funcName) { case 'atan2': if (is_numeric($params[0]) && is_numeric($params[1])) { $result = $funcName(floatval($params[0]), floatval($params[1])); } else { $result = NAN; } break; default: $result = $funcName($params[0], $params[1]); break; } } break; case 3: if (!$this->RDP_onlyparse) { $result = $funcName($params[0], $params[1], $params[2]); } break; case 4: if (!$this->RDP_onlyparse) { $result = $funcName($params[0], $params[1], $params[2], $params[3]); } break; case 5: if (!$this->RDP_onlyparse) { $result = $funcName($params[0], $params[1], $params[2], $params[3], $params[4]); } break; case 6: if (!$this->RDP_onlyparse) { $result = $funcName($params[0], $params[1], $params[2], $params[3], $params[4], $params[5]); } break; default: $this->RDP_AddError(sprintf(gT("Unsupported number of arguments: %s", $argsPassed)), $funcNameToken); return false; } } else { $this->RDP_AddError(sprintf(gT("Function does not support %s arguments"), $argsPassed) . ' ' . sprintf(gT("Function supports this many arguments, where -1=unlimited: %s"), implode(',', $numArgsAllowed)), $funcNameToken); return false; } } catch (Exception $e) { $this->RDP_AddError($e->getMessage(), $funcNameToken); return false; } $token = array($result, $funcNameToken[1], 'NUMBER'); $this->RDP_StackPush($token); return true; } }
private function ngT($sTextToTranslateSingular, $sTextToTranslatePlural, $number, $escapemode = 'html') { return ngT($sTextToTranslateSingular, $sTextToTranslatePlural, $number, $escapemode); }
<span class="ui-button-text"><?php eT("Cancel"); ?></span> </a> <?php echo CHtml::submitButton(gT("Continue"), array('class'=>"ajax_button ui-button ui-widget ui-state-default ui-corner-all",)); ?> <?php echo CHtml::endForm(); ?> </div> </div> <!-- The key informations--> <div id="keyInfos"> <p></p> <div> <h4><?php eT('ComfortUpdate key information'); ?></h4> <strong><?php printf(gT('Your update key is %s.'),$serverAnswer->key_infos->keyid); ?></strong><br/> <strong><?php printf(gT('Your key is valid until %s.'),$serverAnswer->key_infos->validuntil); ?></strong><br/> <?php if ($serverAnswer->key_infos->remaining_updates!=-999) { ?> <strong><?php printf(ngT('It still has %s remaining updates.',$serverAnswer->key_infos->remaining_updates),$serverAnswer->key_infos->remaining_updates); ?> </strong><br/> <?php } ?> </div> <div id="keyInfosbuttons"> <?php if ($serverAnswer->key_infos->remaining_updates!=-999) { ?> <a class="button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only limebutton" href="https://www.limesurvey.org/en/" role="button" aria-disabled="false" target="_blank"> <span class="ui-button-text"><?php eT("Renew this key"); ?></span> </a> <?php } ?> <a class="button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only limebutton" href="<?php echo $urlNew;?>" role="button" aria-disabled="false"> <span class="ui-button-text"><?php eT("Enter a new key"); ?></span> </a> </div> </div>
/** * Returns a string with the number of participants available for export or 0 * * @param type $search * @return string|int */ protected function csvExportCount($search = null) { if (!Permission::model()->hasGlobalPermission('participantpanel', 'export')) { return 0; } $attid = ParticipantAttributeName::model()->getVisibleAttributes(); //If super admin all the participants will be visible if (Permission::model()->hasGlobalPermission('superadmin', 'read')) { $iUserID = null; } else { $iUserID = Yii::app()->session['loginID']; } $count = Participant::model()->getParticipantsCount($attid, $search, $iUserID); if ($count > 0) { return ngT("Export {n} participant to CSV|Export {n} participants to CSV", $count); } else { return $count; } }
/** * Translation helper function for plural forms which outputs right away * @param string $sToTranslate * @param integer $iCount * @param string $sEscapeMode */ function neT($sToTranslate, $iCount, $sEscapeMode = 'html') { echo ngT($sToTranslate, $iCount, $sEscapeMode); }
eT('ComfortUpdate key information'); ?> </h4> <strong><?php printf(gT('Your update key is %s.'), $serverAnswer->key_infos->keyid); ?> </strong><br/> <strong><?php printf(gT('Your key is valid until %s.'), $serverAnswer->key_infos->validuntil); ?> </strong><br/> <?php if ($serverAnswer->key_infos->remaining_updates != -999) { ?> <strong><?php printf(ngT('It still has %s remaining updates.', $serverAnswer->key_infos->remaining_updates), $serverAnswer->key_infos->remaining_updates); ?> </strong><br/> <?php } ?> </div> <div style ="float: right; clear: both; padding-top: 100px;" > <?php if ($serverAnswer->key_infos->remaining_updates != -999) { ?> <a class="button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only limebutton" href="https://www.limesurvey.org/en/" role="button" aria-disabled="false" target="_blank"> <span class="ui-button-text"><?php eT("Renew this key"); ?> </span>