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


PHP dbExecuteAssoc函数代码示例

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


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

示例1: _surveyExistsAndIsActive

 function _surveyExistsAndIsActive($surveyId)
 {
     $isSurveyActive = false;
     $surveyExists = false;
     if ($surveyId) {
         $aRow = dbExecuteAssoc("SELECT active FROM {{surveys}} WHERE sid='" . $surveyId . "'")->read();
         if (isset($aRow['active'])) {
             $surveyExists = true;
             if ($aRow['active'] == 'Y') {
                 $isSurveyActive = true;
             }
         }
     }
     return array($surveyExists, $isSurveyActive);
 }
开发者ID:ryu1inaba,项目名称:LimeSurvey,代码行数:15,代码来源:index.php

示例2: getGroupUserList

function getGroupUserList($ugid)
{
    Yii::app()->loadHelper('database');
    $ugid = sanitize_int($ugid);
    $surveyidquery = "SELECT a.uid, a.users_name, a.full_name FROM {{users}} AS a LEFT JOIN (SELECT uid AS id FROM {{user_in_groups}} WHERE ugid = {$ugid}) AS b ON a.uid = b.id WHERE id IS NULL ORDER BY a.users_name";
    $surveyidresult = dbExecuteAssoc($surveyidquery);
    //Checked
    if (!$surveyidresult) {
        return "Database Error";
    }
    $surveyselecter = "";
    foreach ($surveyidresult->readAll() as $row) {
        $surveynames[] = $row;
    }
    //$surveynames = $surveyidresult->GetRows();
    if (isset($surveynames)) {
        foreach ($surveynames as $sv) {
            $surveyselecter .= "<option";
            $surveyselecter .= " value='{$sv['uid']}'>{$sv['users_name']} {$sv['full_name']}</option>\n";
        }
    }
    $surveyselecter = "<option value='-1' selected='selected'>" . gT("Please choose...") . "</option>\n" . $surveyselecter;
    return $surveyselecter;
}
开发者ID:GuillaumeSmaha,项目名称:LimeSurvey,代码行数:24,代码来源:common_helper.php

示例3: view

 /**
  * dataentry::view()
  * view a dataentry
  * @param mixed $surveyid
  * @param mixed $lang
  * @return
  */
 public function view($surveyid, $lang = NULL)
 {
     $surveyid = sanitize_int($surveyid);
     $lang = isset($_GET['lang']) ? $_GET['lang'] : NULL;
     if (isset($lang)) {
         $lang = sanitize_languagecode($lang);
     }
     $aViewUrls = array();
     if (hasSurveyPermission($surveyid, 'responses', 'read')) {
         $clang = Yii::app()->lang;
         $sDataEntryLanguage = Survey::model()->findByPk($surveyid)->language;
         $surveyinfo = getSurveyInfo($surveyid);
         $slangs = Survey::model()->findByPk($surveyid)->additionalLanguages;
         $baselang = Survey::model()->findByPk($surveyid)->language;
         array_unshift($slangs, $baselang);
         if (is_null($lang) || !in_array($lang, $slangs)) {
             $sDataEntryLanguage = $baselang;
             $blang = $clang;
         } else {
             Yii::app()->loadLibrary('Limesurvey_lang', array($lang));
             $blang = new Limesurvey_lang($lang);
             $sDataEntryLanguage = $lang;
         }
         $langlistbox = languageDropdown($surveyid, $sDataEntryLanguage);
         $thissurvey = getSurveyInfo($surveyid);
         //This is the default, presenting a blank dataentry form
         LimeExpressionManager::StartSurvey($surveyid, 'survey', NULL, false, LEM_PRETTY_PRINT_ALL_SYNTAX);
         $moveResult = LimeExpressionManager::NavigateForwards();
         $aData['thissurvey'] = $thissurvey;
         $aData['langlistbox'] = $langlistbox;
         $aData['surveyid'] = $surveyid;
         $aData['blang'] = $blang;
         $aData['site_url'] = Yii::app()->homeUrl;
         LimeExpressionManager::StartProcessingPage(true, Yii::app()->baseUrl);
         // means that all variables are on the same page
         $aViewUrls[] = 'caption_view';
         Yii::app()->loadHelper('database');
         // SURVEY NAME AND DESCRIPTION TO GO HERE
         $degquery = "SELECT * FROM {{groups}} WHERE sid={$surveyid} AND language='{$sDataEntryLanguage}' ORDER BY {{groups}}.group_order";
         $degresult = dbExecuteAssoc($degquery);
         // GROUP NAME
         $aDataentryoutput = '';
         foreach ($degresult->readAll() as $degrow) {
             LimeExpressionManager::StartProcessingGroup($degrow['gid'], $thissurvey['anonymized'] != "N", $surveyid);
             $deqquery = "SELECT * FROM {{questions}} WHERE sid={$surveyid} AND parent_qid=0 AND gid={$degrow['gid']} AND language='{$sDataEntryLanguage}'";
             $deqrows = (array) dbExecuteAssoc($deqquery)->readAll();
             $aDataentryoutput .= "\t<tr>\n" . "<td colspan='3' align='center'><strong>" . flattenText($degrow['group_name'], true) . "</strong></td>\n" . "\t</tr>\n";
             $gid = $degrow['gid'];
             $aDataentryoutput .= "\t<tr class='data-entry-separator'><td colspan='3'></td></tr>\n";
             // Perform a case insensitive natural sort on group name then question title of a multidimensional array
             usort($deqrows, 'groupOrderThenQuestionOrder');
             $bgc = 'odd';
             foreach ($deqrows as $deqrow) {
                 $qidattributes = getQuestionAttributeValues($deqrow['qid'], $deqrow['type']);
                 $cdata['qidattributes'] = $qidattributes;
                 $hidden = isset($qidattributes['hidden']) ? $qidattributes['hidden'] : 0;
                 // TODO - can questions be hidden?  Are JavaScript variables names used?  Consistently with everywhere else?
                 //                    LimeExpressionManager::ProcessRelevance($qidattributes['relevance'],$deqrow['qid'],NULL,$deqrow['type'],$hidden);
                 // TMSW Conditions->Relevance:  Show relevance equation instead of conditions here - better yet, have data entry use survey-at-a-time but with different view
                 $qinfo = LimeExpressionManager::GetQuestionStatus($deqrow['qid']);
                 $relevance = trim($qinfo['info']['relevance']);
                 $explanation = trim($qinfo['relEqn']);
                 $validation = trim($qinfo['prettyValidTip']);
                 $qidattributes = getQuestionAttributeValues($deqrow['qid']);
                 $array_filter_help = flattenText($this->_array_filter_help($qidattributes, $sDataEntryLanguage, $surveyid));
                 if ($relevance != '' && $relevance != '1' || $validation != '' || $array_filter_help != '') {
                     $showme = '';
                     if ($bgc == "even") {
                         $bgc = "odd";
                     } else {
                         $bgc = "even";
                     }
                     //Do no alternate on explanation row
                     if ($relevance != '' && $relevance != '1') {
                         $showme = "[" . $blang->gT("Only answer this if the following conditions are met:") . "]<br />{$explanation}\n";
                     }
                     if ($showme != '' && $validation != '') {
                         $showme .= '<br/>';
                     }
                     if ($validation != '') {
                         $showme .= "[" . $blang->gT("The answer(s) must meet these validation criteria:") . "]<br />{$validation}\n";
                     }
                     if ($showme != '' && $array_filter_help != '') {
                         $showme .= '<br/>';
                     }
                     if ($array_filter_help != '') {
                         $showme .= "[" . $blang->gT("The answer(s) must meet these array_filter criteria:") . "]<br />{$array_filter_help}\n";
                     }
                     $cdata['explanation'] = "<tr class ='data-entry-explanation'><td class='data-entry-small-text' colspan='3' align='left'>{$showme}</td></tr>\n";
                 }
                 //END OF GETTING CONDITIONS
                 //Alternate bgcolor for different groups
                 if (!isset($bgc)) {
//.........这里部分代码省略.........
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:101,代码来源:dataentry.php

示例4: UpdateGroupList

/**
* Update SESSION VARIABLE: grouplist
* A list of groups in this survey, ordered by group name.
* @param int surveyid
* @param string language
*/
function UpdateGroupList($surveyid, $language)
{
    $clang = Yii::app()->lang;
    unset($_SESSION['survey_' . $surveyid]['grouplist']);
    $query = "SELECT * FROM {{groups}} WHERE sid={$surveyid} AND language='" . $language . "' ORDER BY group_order";
    $result = dbExecuteAssoc($query) or safeDie("Couldn't get group list<br />{$query}<br />");
    //Checked
    $groupList = array();
    foreach ($result->readAll() as $row) {
        $group = array('gid' => $row['gid'], 'group_name' => $row['group_name'], 'description' => $row['description']);
        $groupList[] = $group;
        $gidList[$row['gid']] = $group;
    }
    if (!Yii::app()->getConfig('previewmode') && isset($_SESSION['survey_' . $surveyid]['groupReMap']) && count($_SESSION['survey_' . $surveyid]['groupReMap']) > 0) {
        // Now adjust the grouplist
        $groupRemap = $_SESSION['survey_' . $surveyid]['groupReMap'];
        $groupListCopy = $groupList;
        foreach ($groupList as $gseq => $info) {
            $gid = $info['gid'];
            if (isset($groupRemap[$gid])) {
                $gid = $groupRemap[$gid];
            }
            $groupListCopy[$gseq] = $gidList[$gid];
        }
        $groupList = $groupListCopy;
    }
    $_SESSION['survey_' . $surveyid]['grouplist'] = $groupList;
}
开发者ID:elcharlygraf,项目名称:Encuesta-YiiFramework,代码行数:34,代码来源:frontend_helper.php

示例5: getSurveyInfo

    $surveyinfo = getSurveyInfo(sanitize_int($_REQUEST['sid']));
    if (isset($surveyinfo['assessments']) && $surveyinfo['assessments']=='Y')
    {
        $_REQUEST['assessments'] = 'Y';
    }
}

$clang = Yii::app()->lang;
Yii::app()->loadHelper('frontend');

if (empty($_REQUEST['sid']))   //  || count($_REQUEST) == 0) {
{
    $query = "select a.surveyls_survey_id as sid, a.surveyls_title as title, b.datecreated, b.assessments "
    . "from {{surveys_languagesettings}} as a join {{surveys}} as b on a.surveyls_survey_id = b.sid"
    . " where a.surveyls_language='en' order by a.surveyls_title, b.datecreated";
    $data = dbExecuteAssoc($query);
    $surveyList='';
    foreach($data->readAll() as $row) {
        $surveyList .= "<option value='" . $row['sid'] .'|' . $row['assessments'] . "'>#" . $row['sid'] . " [" . $row['datecreated'] . '] ' . flattenText($row['title']) . "</option>\n";
    }
    $url = $this->createUrl('admin/expressions/survey_logic_file');
    $form = <<< EOD
<form method='post' action='$url'>
<h3>Generate a logic file for the survey</h3>
<table border='1'>
<tr><th>Parameter</th><th>Value</th></tr>
<tr><td>Survey ID (SID)</td>
<td><select name='sid' id='sid'>
$surveyList
</select></td></tr>
<tr><td>Debug Log Level</td>
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:31,代码来源:survey_logic_file.php

示例6: do_array_dual

function do_array_dual($ia)
{
    global $thissurvey;
    $aLastMoveResult = LimeExpressionManager::GetLastMoveResult();
    $aMandatoryViolationSubQ = $aLastMoveResult['mandViolation'] && $ia[6] == 'Y' ? explode("|", $aLastMoveResult['unansweredSQs']) : array();
    $repeatheadings = Yii::app()->getConfig("repeatheadings");
    $minrepeatheadings = Yii::app()->getConfig("minrepeatheadings");
    $extraclass = "";
    $answertypeclass = "";
    // Maybe not
    $caption = "";
    // Just leave empty, are replaced after
    $inputnames = array();
    $labelans1 = array();
    $labelans = array();
    /*
     * Get Question Attributes
     */
    $aQuestionAttributes = QuestionAttribute::model()->getQuestionAttributes($ia[0]);
    // Get questions and answers by defined order
    if ($aQuestionAttributes['random_order'] == 1) {
        $ansquery = "SELECT * FROM {{questions}} WHERE parent_qid={$ia['0']} AND language='" . $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang'] . "' and scale_id=0 ORDER BY " . dbRandom();
    } else {
        $ansquery = "SELECT * FROM {{questions}} WHERE parent_qid={$ia['0']} AND language='" . $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang'] . "' and scale_id=0 ORDER BY question_order";
    }
    $ansresult = dbExecuteAssoc($ansquery);
    //Checked
    $aSubQuestions = $ansresult->readAll();
    $anscount = count($aSubQuestions);
    $lquery = "SELECT * FROM {{answers}} WHERE scale_id=0 AND qid={$ia[0]} AND language='" . $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang'] . "' ORDER BY sortorder, code";
    $lresult = dbExecuteAssoc($lquery);
    //Checked
    $aAnswersScale0 = $lresult->readAll();
    $lquery1 = "SELECT * FROM {{answers}} WHERE scale_id=1 AND qid={$ia[0]} AND language='" . $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang'] . "' ORDER BY sortorder, code";
    $lresult1 = dbExecuteAssoc($lquery1);
    //Checked
    $aAnswersScale1 = $lresult1->readAll();
    // Set attributes
    if ($aQuestionAttributes['use_dropdown'] == 1) {
        $useDropdownLayout = true;
        $extraclass .= " dropdown-list";
        $answertypeclass .= " dropdown";
        $doDualScaleFunction = "doDualScaleDropDown";
        // javascript funtion to lauch at end of answers
        $caption = gT("A table with a subquestion on each row, with two answers to provide on each line.  Please select the answers.");
    } else {
        $useDropdownLayout = false;
        $extraclass .= " radio-list";
        $answertypeclass .= " radio";
        $doDualScaleFunction = "doDualScaleRadio";
        $caption = gT("A table with one subquestion on each row and two answers to provide on each row. The related answer options are in the top table header row.");
    }
    if (ctype_digit(trim($aQuestionAttributes['repeat_headings'])) && trim($aQuestionAttributes['repeat_headings'] != "")) {
        $repeatheadings = intval($aQuestionAttributes['repeat_headings']);
        $minrepeatheadings = 0;
    }
    $leftheader = trim($aQuestionAttributes['dualscale_headerA'][$_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang']]) != '' ? $leftheader = $aQuestionAttributes['dualscale_headerA'][$_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang']] : '';
    $rightheader = trim($aQuestionAttributes['dualscale_headerB'][$_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang']]) != '' ? $aQuestionAttributes['dualscale_headerB'][$_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang']] : '';
    $answerwidth = trim($aQuestionAttributes['answer_width']) != '' ? $aQuestionAttributes['answer_width'] : 20;
    // Find if we have rigth and center text
    $sQuery = "SELECT count(question) FROM {{questions}} WHERE parent_qid=" . $ia[0] . " and scale_id=0 AND question like '%|%'";
    $rigthCount = Yii::app()->db->createCommand($sQuery)->queryScalar();
    $rightexists = $rigthCount > 0;
    // $right_exists: flag to find out if there are any right hand answer parts. leaving right column but don't force with
    $sQuery = "SELECT count(question) FROM {{questions}} WHERE parent_qid=" . $ia[0] . " and scale_id=0 AND question like '%|%|%'";
    $centerCount = Yii::app()->db->createCommand($sQuery)->queryScalar();
    $centerexists = $centerCount > 0;
    // $center_exists: flag to find out if there are any center hand answer parts. leaving center column but don't force with
    // Label and code for input
    foreach ($aAnswersScale0 as $lrow) {
        $labels0[] = array('code' => $lrow['code'], 'title' => $lrow['answer']);
    }
    foreach ($aAnswersScale1 as $lrow) {
        $labels1[] = array('code' => $lrow['code'], 'title' => $lrow['answer']);
    }
    if (count($aAnswersScale0) > 0 && $anscount) {
        $answer = "";
        $fn = 1;
        // Used by repeat_heading
        // No drop-down
        if ($useDropdownLayout === false) {
            $aData = array();
            $aData['answertypeclass'] = $answertypeclass;
            $columnswidth = 100 - $answerwidth;
            $labelans0 = array();
            $labelans1 = array();
            $labelcode0 = array();
            $labelcode1 = array();
            foreach ($aAnswersScale0 as $lrow) {
                $labelans0[] = $lrow['answer'];
                $labelcode0[] = $lrow['code'];
            }
            foreach ($aAnswersScale1 as $lrow) {
                $labelans1[] = $lrow['answer'];
                $labelcode1[] = $lrow['code'];
            }
            $numrows = count($labelans0) + count($labelans1);
            // Add needed row and fill some boolean: shownoanswer, rightexists, centerexists
            $shownoanswer = $ia[6] != "Y" && SHOW_NO_ANSWER == 1;
            if ($shownoanswer) {
//.........这里部分代码省略.........
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:101,代码来源:qanda_helper.php

示例7: array

 /**
  * TSV survey definition in format readable by TSVSurveyImport
  * one line each per group, question, sub-question, and answer
  * does not use SGQA naming at all.
  * @param type $sid
  * @return type
  */
 public static function &TSVSurveyExport($sid)
 {
     $fields = array('class', 'type/scale', 'name', 'relevance', 'text', 'help', 'language', 'validation', 'mandatory', 'other', 'default', 'same_default', 'allowed_filetypes', 'alphasort', 'answer_width', 'array_filter', 'array_filter_exclude', 'array_filter_style', 'assessment_value', 'category_separator', 'choice_title', 'code_filter', 'commented_checkbox', 'commented_checkbox_auto', 'date_format', 'date_max', 'date_min', 'display_columns', 'display_rows', 'dropdown_dates', 'dropdown_dates_minute_step', 'dropdown_dates_month_style', 'dropdown_prefix', 'dropdown_prepostfix', 'dropdown_separators', 'dropdown_size', 'dualscale_headerA', 'dualscale_headerB', 'em_validation_q', 'em_validation_q_tip', 'em_validation_sq', 'em_validation_sq_tip', 'equals_num_value', 'exclude_all_others', 'exclude_all_others_auto', 'hidden', 'hide_tip', 'input_boxes', 'location_city', 'location_country', 'location_defaultcoordinates', 'location_mapheight', 'location_mapservice', 'location_mapwidth', 'location_mapzoom', 'location_nodefaultfromip', 'location_postal', 'location_state', 'max_answers', 'max_filesize', 'max_num_of_files', 'max_num_value', 'max_num_value_n', 'maximum_chars', 'min_answers', 'min_num_of_files', 'min_num_value', 'min_num_value_n', 'multiflexible_checkbox', 'multiflexible_max', 'multiflexible_min', 'multiflexible_step', 'num_value_int_only', 'numbers_only', 'other_comment_mandatory', 'other_numbers_only', 'other_replace_text', 'page_break', 'parent_order', 'prefix', 'printable_help', 'public_statistics', 'random_group', 'random_order', 'rank_title', 'repeat_headings', 'reverse', 'samechoiceheight', 'samelistheight', 'scale_export', 'show_comment', 'show_grand_total', 'show_title', 'show_totals', 'showpopups', 'slider_accuracy', 'slider_default', 'slider_layout', 'slider_max', 'slider_middlestart', 'slider_min', 'slider_rating', 'slider_reset', 'slider_separator', 'slider_showminmax', 'statistics_graphtype', 'statistics_showgraph', 'statistics_showmap', 'suffix', 'text_input_width', 'time_limit', 'time_limit_action', 'time_limit_countdown_message', 'time_limit_disable_next', 'time_limit_disable_prev', 'time_limit_message', 'time_limit_message_delay', 'time_limit_message_style', 'time_limit_timer_style', 'time_limit_warning', 'time_limit_warning_2', 'time_limit_warning_2_display_time', 'time_limit_warning_2_message', 'time_limit_warning_2_style', 'time_limit_warning_display_time', 'time_limit_warning_message', 'time_limit_warning_style', 'thousands_separator', 'use_dropdown');
     $rows = array();
     $primarylang = 'en';
     $otherlangs = '';
     $langs = array();
     // Export survey-level information
     $query = "select * from {{surveys}} where sid = " . $sid;
     $data = dbExecuteAssoc($query);
     foreach ($data->readAll() as $r) {
         foreach ($r as $key => $value) {
             if ($value != '') {
                 $row['class'] = 'S';
                 $row['name'] = $key;
                 $row['text'] = $value;
                 $rows[] = $row;
             }
             if ($key == 'language') {
                 $primarylang = $value;
             }
             if ($key == 'additional_languages') {
                 $otherlangs = $value;
             }
         }
     }
     $langs = explode(' ', $primarylang . ' ' . $otherlangs);
     $langs = array_unique($langs);
     // Export survey language settings
     $query = "select * from {{surveys_languagesettings}} where surveyls_survey_id = " . $sid;
     $data = dbExecuteAssoc($query);
     foreach ($data->readAll() as $r) {
         $_lang = $r['surveyls_language'];
         foreach ($r as $key => $value) {
             if ($value != '' && $key != 'surveyls_language' && $key != 'surveyls_survey_id') {
                 $row['class'] = 'SL';
                 $row['name'] = $key;
                 $row['text'] = $value;
                 $row['language'] = $_lang;
                 $rows[] = $row;
             }
         }
     }
     $surveyinfo = getSurveyInfo($sid);
     $assessments = false;
     if (isset($surveyinfo['assessments']) && $surveyinfo['assessments'] == 'Y') {
         $assessments = true;
     }
     foreach ($langs as $lang) {
         if (trim($lang) == '') {
             continue;
         }
         SetSurveyLanguage($sid, $lang);
         LimeExpressionManager::StartSurvey($sid, 'survey', array('sgqaNaming' => 'N', 'assessments' => $assessments), true);
         $moveResult = LimeExpressionManager::NavigateForwards();
         $LEM =& LimeExpressionManager::singleton();
         if (is_null($moveResult) || is_null($LEM->currentQset) || count($LEM->currentQset) == 0) {
             continue;
         }
         $_gseq = -1;
         foreach ($LEM->currentQset as $q) {
             $gseq = $q['info']['gseq'];
             $gid = $q['info']['gid'];
             $qid = $q['info']['qid'];
             //////
             // SHOW GROUP-LEVEL INFO
             //////
             if ($gseq != $_gseq) {
                 $_gseq = $gseq;
                 $ginfo = $LEM->gseq2info[$gseq];
                 // if relevance equation is using SGQA coding, convert to qcoding
                 $grelevance = $ginfo['grelevance'] == '' ? 1 : $ginfo['grelevance'];
                 $LEM->em->ProcessBooleanExpression($grelevance, $gseq, 0);
                 // $qseq
                 $grelevance = trim(strip_tags($LEM->em->GetPrettyPrintString()));
                 $gtext = trim($ginfo['description']) == '' ? '' : $ginfo['description'];
                 $row = array();
                 $row['class'] = 'G';
                 //create a group code to allow proper importing of multi-lang survey TSVs
                 $row['type/scale'] = 'G' . $gseq;
                 $row['name'] = $ginfo['group_name'];
                 $row['relevance'] = $grelevance;
                 $row['text'] = $gtext;
                 $row['language'] = $lang;
                 $row['random_group'] = $ginfo['randomization_group'];
                 $rows[] = $row;
             }
             //////
             // SHOW QUESTION-LEVEL INFO
             //////
             $row = array();
             $mandatory = $q['info']['mandatory'] == 'Y' ? 'Y' : '';
             $type = $q['info']['type'];
//.........这里部分代码省略.........
开发者ID:GuillaumeSmaha,项目名称:LimeSurvey,代码行数:101,代码来源:em_manager_helper.php

示例8: view

 /**
  * dataentry::view()
  * view a dataentry
  * @param mixed $surveyid
  * @param mixed $lang
  * @return
  */
 public function view($surveyid, $lang = NULL)
 {
     $surveyid = sanitize_int($surveyid);
     $lang = isset($_GET['lang']) ? $_GET['lang'] : NULL;
     if (isset($lang)) {
         $lang = sanitize_languagecode($lang);
     }
     $aViewUrls = array();
     if (Permission::model()->hasSurveyPermission($surveyid, 'responses', 'create')) {
         $sDataEntryLanguage = Survey::model()->findByPk($surveyid)->language;
         $surveyinfo = getSurveyInfo($surveyid);
         $slangs = Survey::model()->findByPk($surveyid)->additionalLanguages;
         $baselang = Survey::model()->findByPk($surveyid)->language;
         array_unshift($slangs, $baselang);
         if (is_null($lang) || !in_array($lang, $slangs)) {
             $sDataEntryLanguage = $baselang;
         } else {
             $sDataEntryLanguage = $lang;
         }
         $langlistbox = languageDropdown($surveyid, $sDataEntryLanguage);
         $thissurvey = getSurveyInfo($surveyid);
         //This is the default, presenting a blank dataentry form
         LimeExpressionManager::StartSurvey($surveyid, 'survey', NULL, false, LEM_PRETTY_PRINT_ALL_SYNTAX);
         $moveResult = LimeExpressionManager::NavigateForwards();
         $aData['thissurvey'] = $thissurvey;
         $aData['langlistbox'] = $langlistbox;
         $aData['surveyid'] = $surveyid;
         $aData['sDataEntryLanguage'] = $sDataEntryLanguage;
         $aData['site_url'] = Yii::app()->homeUrl;
         LimeExpressionManager::StartProcessingPage(true, Yii::app()->baseUrl);
         // means that all variables are on the same page
         $aViewUrls[] = 'caption_view';
         Yii::app()->loadHelper('database');
         // SURVEY NAME AND DESCRIPTION TO GO HERE
         $degquery = "SELECT * FROM {{groups}} WHERE sid={$surveyid} AND language='{$sDataEntryLanguage}' ORDER BY {{groups}}.group_order";
         $degresult = dbExecuteAssoc($degquery);
         // GROUP NAME
         $aDataentryoutput = '';
         foreach ($degresult->readAll() as $degrow) {
             LimeExpressionManager::StartProcessingGroup($degrow['gid'], $thissurvey['anonymized'] != "N", $surveyid);
             $deqquery = "SELECT * FROM {{questions}} WHERE sid={$surveyid} AND parent_qid=0 AND gid={$degrow['gid']} AND language='{$sDataEntryLanguage}'";
             $deqrows = (array) dbExecuteAssoc($deqquery)->readAll();
             $aDataentryoutput .= "\t<tr class='info'>\n" . "<!-- Inside controller dataentry.php -->" . "<td colspan='3'><h4>" . flattenText($degrow['group_name'], true) . "</h4></td>\n" . "\t</tr>\n";
             $gid = $degrow['gid'];
             $aDataentryoutput .= "\t<tr class='data-entry-separator'><td colspan='3'></td></tr>\n";
             // Perform a case insensitive natural sort on group name then question title of a multidimensional array
             usort($deqrows, 'groupOrderThenQuestionOrder');
             $bgc = 'odd';
             foreach ($deqrows as $deqrow) {
                 $cdata = array();
                 $qidattributes = getQuestionAttributeValues($deqrow['qid']);
                 $cdata['qidattributes'] = $qidattributes;
                 $hidden = isset($qidattributes['hidden']) ? $qidattributes['hidden'] : 0;
                 // TODO - can questions be hidden?  Are JavaScript variables names used?  Consistently with everywhere else?
                 //                    LimeExpressionManager::ProcessRelevance($qidattributes['relevance'],$deqrow['qid'],NULL,$deqrow['type'],$hidden);
                 // TMSW Condition->Relevance:  Show relevance equation instead of conditions here - better yet, have data entry use survey-at-a-time but with different view
                 $qinfo = LimeExpressionManager::GetQuestionStatus($deqrow['qid']);
                 $relevance = trim($qinfo['info']['relevance']);
                 $explanation = trim($qinfo['relEqn']);
                 $validation = trim($qinfo['prettyValidTip']);
                 $qidattributes = getQuestionAttributeValues($deqrow['qid']);
                 $array_filter_help = flattenText($this->_array_filter_help($qidattributes, $sDataEntryLanguage, $surveyid));
                 if ($relevance != '' && $relevance != '1' || $validation != '' || $array_filter_help != '') {
                     $showme = '<div class="alert alert-warning col-sm-8 col-sm-offset-2" role="alert">';
                     if ($bgc == "even") {
                         $bgc = "odd";
                     } else {
                         $bgc = "even";
                     }
                     //Do no alternate on explanation row
                     if ($relevance != '' && $relevance != '1') {
                         $showme = '<strong>' . gT("Only answer this if the following conditions are met:", 'html', $sDataEntryLanguage) . "</strong><br />{$explanation}\n";
                     }
                     if ($validation != '') {
                         $showme .= '<strong>' . gT("The answer(s) must meet these validation criteria:", 'html', $sDataEntryLanguage) . "</strong><br />{$validation}\n";
                     }
                     if ($showme != '' && $array_filter_help != '') {
                         $showme .= '<br/>';
                     }
                     if ($array_filter_help != '') {
                         $showme .= '<strong>' . gT("The answer(s) must meet these array_filter criteria:", 'html', $sDataEntryLanguage) . "</strong><br />{$array_filter_help}\n";
                     }
                     $showme .= '</div>';
                     $cdata['explanation'] = "<tr class ='data-entry-explanation'><td class='data-entry-small-text' colspan='3' align='left'>{$showme}</td></tr>\n";
                 }
                 //END OF GETTING CONDITIONS
                 //Alternate bgcolor for different groups
                 if (!isset($bgc)) {
                     $bgc = "even";
                 }
                 if ($bgc == "even") {
                     $bgc = "odd";
                 } else {
//.........这里部分代码省略.........
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:101,代码来源:dataentry.php

示例9: getNumberOfQuestions

 /**
  * Used in frontend helper, buildsurveysession.
  * @todo Rename
  * @param int $surveyid
  * @return array|false??? Return from CDbDataReader::read()
  */
 public static function getNumberOfQuestions($surveyid)
 {
     return dbExecuteAssoc("SELECT count(*)\n" . " FROM {{questions}}" . " WHERE type in ('X','*')\n" . " AND sid={$surveyid}" . " AND language='" . $_SESSION['survey_' . $surveyid]['s_lang'] . "'" . " AND parent_qid=0")->read();
 }
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:10,代码来源:Question.php

示例10: do_array_dual

function do_array_dual($ia)
{
    global $thissurvey;
    global $notanswered;
    $repeatheadings = Yii::app()->getConfig("repeatheadings");
    $minrepeatheadings = Yii::app()->getConfig("minrepeatheadings");
    $extraclass = "";
    $answertypeclass = "";
    // Maybe not
    $clang = Yii::app()->lang;
    $checkconditionFunction = "checkconditions";
    $inputnames = array();
    $labelans1 = array();
    $labelans = array();
    $qquery = "SELECT other FROM {{questions}} WHERE qid=" . $ia[0] . " AND language='" . $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang'] . "'";
    $other = dbExecuteAssoc($qquery)->read();
    $other = reset($other);
    //Checked
    $lquery = "SELECT * FROM {{answers}} WHERE scale_id=0 AND qid={$ia[0]} AND language='" . $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang'] . "' ORDER BY sortorder, code";
    $lquery1 = "SELECT * FROM {{answers}} WHERE scale_id=1 AND qid={$ia[0]} AND language='" . $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang'] . "' ORDER BY sortorder, code";
    $aQuestionAttributes = getQuestionAttributeValues($ia[0], $ia[4]);
    if ($aQuestionAttributes['use_dropdown'] == 1) {
        $useDropdownLayout = true;
        $extraclass .= " dropdown-list";
        $answertypeclass .= " dropdown";
    } else {
        $useDropdownLayout = false;
        $extraclass .= " radio-list";
        $answertypeclass .= " radio";
    }
    if (ctype_digit(trim($aQuestionAttributes['repeat_headings'])) && trim($aQuestionAttributes['repeat_headings'] != "")) {
        $repeatheadings = intval($aQuestionAttributes['repeat_headings']);
        $minrepeatheadings = 0;
    }
    if (trim($aQuestionAttributes['dualscale_headerA'][$_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang']]) != '') {
        $leftheader = $clang->gT($aQuestionAttributes['dualscale_headerA'][$_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang']]);
    } else {
        $leftheader = '';
    }
    if (trim($aQuestionAttributes['dualscale_headerB'][$_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang']]) != '') {
        $rightheader = $clang->gT($aQuestionAttributes['dualscale_headerB'][$_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang']]);
    } else {
        $rightheader = '';
    }
    $lresult = dbExecuteAssoc($lquery);
    //Checked
    $aAnswersScale1 = $lresult->readAll();
    if ($useDropdownLayout === false && count($aAnswersScale1) > 0) {
        if (trim($aQuestionAttributes['answer_width']) != '') {
            $answerwidth = $aQuestionAttributes['answer_width'];
        } else {
            $answerwidth = 20;
        }
        $columnswidth = 100 - $answerwidth;
        foreach ($aAnswersScale1 as $lrow) {
            $labelans[] = $lrow['answer'];
            $labelcode[] = $lrow['code'];
        }
        $lresult1 = dbExecuteAssoc($lquery1);
        //Checked
        foreach ($lresult1->readAll() as $lrow1) {
            $labelans1[] = $lrow1['answer'];
            $labelcode1[] = $lrow1['code'];
        }
        $numrows = count($labelans) + count($labelans1);
        if ($ia[6] != "Y" && SHOW_NO_ANSWER == 1) {
            $numrows++;
        }
        $cellwidth = $columnswidth / $numrows;
        $cellwidth = sprintf("%02d", $cellwidth);
        $sQuery = "SELECT count(question) FROM {{questions}} WHERE parent_qid=" . $ia[0] . " and scale_id=0 AND question like '%|%'";
        $iCount = Yii::app()->db->createCommand($sQuery)->queryScalar();
        $right_exists = $iCount > 0;
        // $right_exists is a flag to find out if there are any right hand answer parts. If there aren't we can leave out the right td column
        if ($aQuestionAttributes['random_order'] == 1) {
            $ansquery = "SELECT * FROM {{questions}} WHERE parent_qid={$ia['0']} AND language='" . $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang'] . "' and scale_id=0 ORDER BY " . dbRandom();
        } else {
            $ansquery = "SELECT * FROM {{questions}} WHERE parent_qid={$ia['0']} AND language='" . $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang'] . "' and scale_id=0 ORDER BY question_order";
        }
        $ansresult = dbExecuteAssoc($ansquery);
        //Checked
        $aQuestionsRight = $ansresult->readAll();
        $anscount = count($aQuestionsRight);
        $fn = 1;
        // unselect second scale when using "no answer"
        $answer = "<script type='text/javascript'>\n" . "<!--\n" . "function noanswer_checkconditions(value, name, type)\n" . "{\n" . "\tvar vname;\n" . "\tvname = name.replace(/#.*\$/,\"\");\n" . "\t\$('input[name^=\"' + vname + '\"]').attr('checked',false);\n" . "\t\$('input[id=\"answer' + vname + '#0-\"]').attr('checked',true);\n" . "\t\$('input[name^=\"java' + vname + '\"]').val('');\n" . "\t{$checkconditionFunction}(value, name, type);\n" . "}\n" . "function secondlabel_checkconditions(value, name, type)\n" . "{\n" . "\tvar vname;\n" . "\tvname = \"answer\"+name.replace(/#1/g,\"#0-\");\n" . "\tif(document.getElementById(vname))\n" . "\t{\n" . "\tdocument.getElementById(vname).checked=false;\n" . "\t}\n" . "\t{$checkconditionFunction}(value, name, type);\n" . "}\n" . " //-->\n" . " </script>\n";
        // Header row and colgroups
        $mycolumns = "\t<colgroup class=\"col-responses group-1\">\n" . "\t<col class=\"col-answers\" width=\"{$answerwidth}%\" />\n";
        $answer_head_line = "\t<th class=\"header_answer_text\">&nbsp;</th>\n\n";
        $odd_even = '';
        foreach ($labelans as $ld) {
            $answer_head_line .= "\t<th>" . $ld . "</th>\n";
            $odd_even = alternation($odd_even);
            $mycolumns .= "<col class=\"{$odd_even}\" width=\"{$cellwidth}%\" />\n";
        }
        $mycolumns .= "\t</colgroup>\n";
        if (count($labelans1) > 0) {
            $mycolumns .= "\t<colgroup class=\"col-responses group-2\">\n" . "\t<col class=\"seperator\" />\n";
            $answer_head_line .= "\n\t<td class=\"header_separator\">&nbsp;</td>\n\n";
            // Separator
//.........这里部分代码省略.........
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:101,代码来源:qanda_helper.php

示例11: savedsilent

 /**
  * savesilent() saves survey responses when the "Resume later" button
  * is press but has no interaction. i.e. it does not ask for email,
  * username or password or capture.
  *
  * @return string confirming successful save.
  */
 function savedsilent()
 {
     global $surveyid, $thissurvey, $errormsg, $publicurl, $sitename, $timeadjust, $clang, $clienttoken, $thisstep;
     submitanswer();
     // Prepare email
     $tokenentryquery = 'SELECT * from {{tokens_' . $surveyid . '}} WHERE token=\'' . sanitize_paranoid_string($clienttoken) . '\';';
     $tokenentryresult = dbExecuteAssoc($tokenentryquery);
     $tokenentryarray = $tokenentryresult->read();
     $from = $thissurvey['adminname'] . ' <' . $thissurvey['adminemail'] . '>';
     $to = $tokenentryarray['firstname'] . ' ' . $tokenentryarray['lastname'] . ' <' . $tokenentryarray['email'] . '>';
     $subject = $clang->gT("Saved Survey Details") . " - " . $thissurvey['name'];
     $message = $clang->gT("Thank you for saving your survey in progress. You can return to the survey at the same point you saved it at any time using the link from this or any previous email sent to regarding this survey.") . "\n\n";
     $message .= $clang->gT("Reload your survey by clicking on the following link (or pasting it into your browser):") . ":\n";
     $language = $tokenentryarray['language'];
     //$message .= "\n\n$publicurl/$surveyid/lang-$language/tk-$clienttoken";
     $message .= "\n\n" . Yii::app()->getController()->createAbsoluteUrl("/survey/index/sid/{$surveyid}/lang/{$language}/token/{$clienttoken}");
     if (SendEmailMessage($message, $subject, $to, $from, $sitename, false, getBounceEmail($surveyid))) {
         $emailsent = "Y";
     } else {
         $clang->eT('Error: Email failed, this may indicate a PHP Mail Setup problem on your server. Your survey details have still been saved, however you will not get an email with the details. You should note the "name" and "password" you just used for future reference.');
         if (trim($thissurvey['adminemail']) == '') {
             $clang->eT('(Reason: Admin email address empty)');
         }
     }
     return $clang->gT('Your survey was successfully saved.');
 }
开发者ID:ryu1inaba,项目名称:LimeSurvey,代码行数:33,代码来源:Save.php

示例12: dbExecuteAssoc

                            </th>
                            <th><?php 
        $clang->eT("Answer option");
        ?>
</th>
                            <th><?php 
        $clang->eT("Actions");
        ?>
</th>
                        </tr></thead>
                    <tbody>
                    <?php 
        $alternate = true;
        $query = "SELECT * FROM {{answers}} WHERE qid='{$qid}' AND language='{$anslang}' and scale_id={$scale_id} ORDER BY sortorder, code";
        $result = dbExecuteAssoc($query);
        $aResults = $result->readAll();
        $anscount = count($aResults);
        foreach ($aResults as $row) {
            $row['code'] = htmlspecialchars($row['code']);
            $row['answer'] = htmlspecialchars($row['answer']);
            ?>
                        <tr class='row_<?php 
            echo $position;
            if ($alternate == true) {
                ?>
 highlight<?php 
            }
            $alternate = !$alternate;
            ?>
'><td>
开发者ID:ryu1inaba,项目名称:LimeSurvey,代码行数:30,代码来源:answerOptions_view.php

示例13: array

 /**
  * TSV survey definition in format readable by TSVSurveyImport
  * one line each per group, question, sub-question, and answer
  * does not use SGQA naming at all.
  * @param type $sid
  * @return type
  */
 public static function &TSVSurveyExport($sid)
 {
     $aBaseFields = array('class', 'type/scale', 'name', 'relevance', 'text', 'help', 'language', 'validation', 'mandatory', 'other', 'default', 'same_default');
     // Advanced question attributes : @todo get used question attribute by question in survey ?
     $aQuestionAttributes = array_keys(\ls\helpers\questionHelper::getAttributesDefinitions());
     sort($aQuestionAttributes);
     $fields = array_merge($aBaseFields, $aQuestionAttributes);
     $rows = array();
     $primarylang = 'en';
     $otherlangs = '';
     $langs = array();
     // Export survey-level information
     $query = "select * from {{surveys}} where sid = " . $sid;
     $data = dbExecuteAssoc($query);
     foreach ($data->readAll() as $r) {
         foreach ($r as $key => $value) {
             if ($value != '') {
                 $row['class'] = 'S';
                 $row['name'] = $key;
                 $row['text'] = $value;
                 $rows[] = $row;
             }
             if ($key == 'language') {
                 $primarylang = $value;
             }
             if ($key == 'additional_languages') {
                 $otherlangs = $value;
             }
         }
     }
     $langs = explode(' ', $primarylang . ' ' . $otherlangs);
     $langs = array_unique($langs);
     // Export survey language settings
     $query = "select * from {{surveys_languagesettings}} where surveyls_survey_id = " . $sid;
     $data = dbExecuteAssoc($query);
     foreach ($data->readAll() as $r) {
         $_lang = $r['surveyls_language'];
         foreach ($r as $key => $value) {
             if ($value != '' && $key != 'surveyls_language' && $key != 'surveyls_survey_id') {
                 $row['class'] = 'SL';
                 $row['name'] = $key;
                 $row['text'] = $value;
                 $row['language'] = $_lang;
                 $rows[] = $row;
             }
         }
     }
     $surveyinfo = getSurveyInfo($sid);
     $assessments = false;
     if (isset($surveyinfo['assessments']) && $surveyinfo['assessments'] == 'Y') {
         $assessments = true;
     }
     foreach ($langs as $lang) {
         if (trim($lang) == '') {
             continue;
         }
         SetSurveyLanguage($sid, $lang);
         LimeExpressionManager::StartSurvey($sid, 'survey', array('sgqaNaming' => 'N', 'assessments' => $assessments), true);
         $moveResult = LimeExpressionManager::NavigateForwards();
         $LEM =& LimeExpressionManager::singleton();
         if (is_null($moveResult) || is_null($LEM->currentQset) || count($LEM->currentQset) == 0) {
             continue;
         }
         $_gseq = -1;
         foreach ($LEM->currentQset as $q) {
             $gseq = $q['info']['gseq'];
             $gid = $q['info']['gid'];
             $qid = $q['info']['qid'];
             //////
             // SHOW GROUP-LEVEL INFO
             //////
             if ($gseq != $_gseq) {
                 $_gseq = $gseq;
                 $ginfo = $LEM->gseq2info[$gseq];
                 // if relevance equation is using SGQA coding, convert to qcoding
                 $grelevance = $ginfo['grelevance'] == '' ? 1 : $ginfo['grelevance'];
                 $LEM->em->ProcessBooleanExpression($grelevance, $gseq, 0);
                 // $qseq
                 $grelevance = trim(strip_tags($LEM->em->GetPrettyPrintString()));
                 $gtext = trim($ginfo['description']) == '' ? '' : $ginfo['description'];
                 $row = array();
                 $row['class'] = 'G';
                 //create a group code to allow proper importing of multi-lang survey TSVs
                 $row['type/scale'] = 'G' . $gseq;
                 $row['name'] = $ginfo['group_name'];
                 $row['relevance'] = $grelevance;
                 $row['text'] = $gtext;
                 $row['language'] = $lang;
                 $row['random_group'] = $ginfo['randomization_group'];
                 $rows[] = $row;
             }
             //////
             // SHOW QUESTION-LEVEL INFO
//.........这里部分代码省略.........
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:101,代码来源:em_manager_helper.php

示例14: index

 /**
  * Load viewing of a user group screen.
  * @param bool $ugid
  * @param array|bool $header (type=success, warning)(message=localized message)
  * @return void
  */
 public function index($ugid = false, $header = false)
 {
     if (!Permission::model()->hasGlobalPermission('usergroups', 'read')) {
         Yii::app()->session['flashmessage'] = gT('Access denied!');
         $this->getController()->redirect(App()->createUrl("/admin"));
     }
     if ($ugid != false) {
         $ugid = (int) $ugid;
     }
     if (!empty($header)) {
         $aData['headercfg'] = $header;
     } else {
         $aData = array();
     }
     $aViewUrls = array();
     $aData['ugid'] = $ugid;
     $aData['imageurl'] = Yii::app()->getConfig("adminimageurl");
     if (Yii::app()->session['loginID']) {
         if ($ugid) {
             $ugid = sanitize_int($ugid);
             $aData["usergroupid"] = $ugid;
             $result = UserGroup::model()->requestViewGroup($ugid, Yii::app()->session["loginID"]);
             $crow = $result[0];
             if ($result) {
                 $aData["groupfound"] = true;
                 $aData["groupname"] = $crow['name'];
                 if (!empty($crow['description'])) {
                     $aData["usergroupdescription"] = $crow['description'];
                 } else {
                     $aData["usergroupdescription"] = "";
                 }
             }
             //$this->user_in_groups_model = new User_in_groups;
             $eguquery = "SELECT * FROM {{user_in_groups}} AS a INNER JOIN {{users}} AS b ON a.uid = b.uid WHERE ugid = " . $ugid . " ORDER BY b.users_name";
             $eguresult = dbExecuteAssoc($eguquery);
             $aUserInGroupsResult = $eguresult->readAll();
             $query2 = "SELECT ugid FROM {{user_groups}} WHERE ugid = " . $ugid;
             if (!Permission::model()->hasGlobalPermission('superadmin', 'read')) {
                 $query2 .= " AND owner_id = " . Yii::app()->session['loginID'];
             }
             $result2 = dbSelectLimitAssoc($query2, 1);
             $row2 = $result2->readAll();
             $row = 1;
             $userloop = array();
             $bgcc = "oddrow";
             foreach ($aUserInGroupsResult as $egurow) {
                 if ($bgcc == "evenrow") {
                     $bgcc = "oddrow";
                 } else {
                     $bgcc = "evenrow";
                 }
                 $userloop[$row]["userid"] = $egurow['uid'];
                 //	output users
                 $userloop[$row]["rowclass"] = $bgcc;
                 if (Permission::model()->hasGlobalPermission('superadmin', 'update')) {
                     $userloop[$row]["displayactions"] = true;
                 } else {
                     $userloop[$row]["displayactions"] = false;
                 }
                 $userloop[$row]["username"] = $egurow['users_name'];
                 $userloop[$row]["email"] = $egurow['email'];
                 $row++;
             }
             $aData["userloop"] = $userloop;
             if (isset($row2[0]['ugid'])) {
                 $aData["useradddialog"] = true;
                 $aData["useraddusers"] = getGroupUserList($ugid, 'optionlist');
                 $aData["useraddurl"] = "";
             }
             $aViewUrls[] = 'viewUserGroup_view';
         } else {
             //show listing
             $aViewUrls['usergroups_view'][] = array();
             $aData['model'] = UserGroup::model();
         }
     }
     if ($ugid == false) {
         $aData['usergroupbar']['returnbutton']['url'] = 'admin/index';
         $aData['usergroupbar']['returnbutton']['text'] = gT('Return to admin home');
     } else {
         $aData['usergroupbar']['edit'] = TRUE;
         $aData['usergroupbar']['closebutton']['url'] = Yii::app()->createUrl('admin/usergroups/sa/view');
         // Close button
     }
     if (isset($_GET['pageSize'])) {
         Yii::app()->user->setState('pageSize', (int) $_GET['pageSize']);
     }
     if (!empty($header)) {
         return array($aViewUrls, $aData);
     } else {
         $this->_renderWrappedTemplate('usergroup', $aViewUrls, $aData);
     }
 }
开发者ID:sickpig,项目名称:LimeSurvey,代码行数:99,代码来源:usergroups.php

示例15: getUrlParamsJSON

 function getUrlParamsJSON($iSurveyID)
 {
     $iSurveyID = (int) $iSurveyID;
     Yii::app()->loadHelper('database');
     $oResult = dbExecuteAssoc("select '' as act, up.*,q.title, sq.title as sqtitle, q.question, sq.question as sqquestion from {{survey_url_parameters}} up\n        left join {{questions}} q on q.qid=up.targetqid\n        left join {{questions}} sq on sq.qid=up.targetsqid\n        where up.sid={$iSurveyID}");
     $oResult = $oResult->readAll();
     $i = 0;
     $clang = $this->getController()->lang;
     $aData = new stdClass();
     foreach ($oResult as $oRow) {
         $aData->rows[$i]['id'] = $oRow['id'];
         if (!is_null($oRow['question'])) {
             $oRow['title'] .= ': ' . ellipsize(flattenText($oRow['question'], false, true), 43, 0.7);
         } else {
             $oRow['title'] = $clang->gT('(No target question)');
         }
         if ($oRow['sqquestion'] != '') {
             $oRow['title'] .= ' - ' . ellipsize(flattenText($oRow['sqquestion'], false, true), 30, 0.75);
         }
         unset($oRow['sqquestion']);
         unset($oRow['sqtitle']);
         unset($oRow['question']);
         $aData->rows[$i]['cell'] = array_values($oRow);
         $i++;
     }
     $aData->page = 1;
     $aData->records = count($oResult);
     $aData->total = 1;
     echo ls_json_encode($aData);
 }
开发者ID:ravindrakhokharia,项目名称:LimeSurvey,代码行数:30,代码来源:surveyadmin.php


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