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


PHP db_select_limit_assoc函数代码示例

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


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

示例1: getInitialAdmin_uid

 function getInitialAdmin_uid()
 {
     global $dbprefix;
     // Initial SuperAdmin has parent_id == 0
     $adminquery = "SELECT uid FROM {$dbprefix}users WHERE parent_id=0";
     $adminresult = db_select_limit_assoc($adminquery, 1);
     $row = $adminresult->FetchRow();
     return $row['uid'];
 }
开发者ID:karime7gezly,项目名称:OpenConextApps-LimeSurvey,代码行数:9,代码来源:usercontrol.php

示例2: fixNumbering

/**
* fixes the numbering of questions
* @global $dbprefix $dbprefix
* @global $connect $connect
* @global $clang $clang
* @param <type> $fixnumbering
*/
function fixNumbering($fixnumbering)
{
    global $dbprefix, $connect, $clang, $surveyid;
    LimeExpressionManager::RevertUpgradeConditionsToRelevance($surveyid);
    //Fix a question id - requires renumbering a question
    $oldqid = sanitize_int($fixnumbering);
    $query = "SELECT qid FROM {$dbprefix}questions ORDER BY qid DESC";
    $result = db_select_limit_assoc($query, 1) or safe_die($query . "<br />" . $connect->ErrorMsg());
    while ($row = $result->FetchRow()) {
        $lastqid = $row['qid'];
    }
    $newqid = $lastqid + 1;
    $query = "UPDATE {$dbprefix}questions SET qid={$newqid} WHERE qid={$oldqid}";
    $result = $connect->Execute($query) or safe_die($query . "<br />" . $connect->ErrorMsg());
    // Update subquestions
    $query = "UPDATE {$dbprefix}questions SET parent_qid={$newqid} WHERE parent_qid={$oldqid}";
    $result = $connect->Execute($query) or safe_die($query . "<br />" . $connect->ErrorMsg());
    //Update conditions.. firstly conditions FOR this question
    $query = "UPDATE {$dbprefix}conditions SET qid={$newqid} WHERE qid={$oldqid}";
    $result = $connect->Execute($query) or safe_die($query . "<br />" . $connect->ErrorMsg());
    //Now conditions based upon this question
    $query = "SELECT cqid, cfieldname FROM {$dbprefix}conditions WHERE cqid={$oldqid}";
    $result = db_execute_assoc($query) or safe_die($query . "<br />" . $connect->ErrorMsg());
    while ($row = $result->FetchRow()) {
        $switcher[] = array("cqid" => $row['cqid'], "cfieldname" => $row['cfieldname']);
    }
    if (isset($switcher)) {
        foreach ($switcher as $switch) {
            $query = "UPDATE {$dbprefix}conditions\n            SET cqid={$newqid},\n            cfieldname='" . str_replace("X" . $oldqid, "X" . $newqid, $switch['cfieldname']) . "'\n            WHERE cqid={$oldqid}";
            $result = $connect->Execute($query) or safe_die($query . "<br />" . $connect->ErrorMsg());
        }
    }
    //Now question_attributes
    $query = "UPDATE {$dbprefix}question_attributes SET qid={$newqid} WHERE qid={$oldqid}";
    $result = $connect->Execute($query) or safe_die($query . "<br />" . $connect->ErrorMsg());
    //Now answers
    $query = "UPDATE {$dbprefix}answers SET qid={$newqid} WHERE qid={$oldqid}";
    $result = $connect->Execute($query) or safe_die($query . "<br />" . $connect->ErrorMsg());
    LimeExpressionManager::UpgradeConditionsToRelevance($surveyid);
}
开发者ID:ddrmoscow,项目名称:queXS,代码行数:47,代码来源:activate_functions.php

示例3: db_execute_assoc

{
    if ($subaction == "edit")
    {
        $edquery = "SELECT * FROM ".db_table_name("tokens_$surveyid")." WHERE tid={$tokenid}";
        $edresult = db_execute_assoc($edquery);
        $edfieldcount = $edresult->FieldCount();
        while($edrow = $edresult->FetchRow())
        {
            //Create variables with the same names as the database column names and fill in the value
            foreach ($edrow as $Key=>$Value) {$$Key = $Value;}
        }
    }
    if ($subaction != "edit")
    {
        $edquery = "SELECT * FROM ".db_table_name("tokens_$surveyid");
        $edresult = db_select_limit_assoc($edquery, 1);
        $edfieldcount = $edresult->FieldCount();
    }

    $tokenoutput .= "<div class='header ui-widget-header'>";
    if ($subaction == "edit")
    {
        $tokenoutput .=$clang->gT("Edit token entry");
    }
    else
    {
        $tokenoutput .=$clang->gT("Add token entry");
    }

    $tokenoutput .="</div>"
    ."<form id='edittoken' class='form30' method='post' action='$scriptname?action=tokens'>\n"
开发者ID:nmklong,项目名称:limesurvey-cdio3,代码行数:31,代码来源:tokens.php

示例4: while

 while ($dtrow = $dtresult->FetchRow()) {
     $dtcount = $dtrow[0];
 }
 if ($limit > $dtcount) {
     $limit = $dtcount;
 }
 //NOW LETS SHOW THE DATA
 $dtquery = "SELECT t.* FROM {$surveytimingstable} t INNER JOIN {$surveytable} ON t.id={$surveytable}.id WHERE submitdate IS NOT NULL ORDER BY {$surveytable}.id";
 if ($order == "desc") {
     $dtquery .= " DESC";
 }
 if (isset($limit)) {
     if (!isset($start)) {
         $start = 0;
     }
     $dtresult = db_select_limit_assoc($dtquery, $limit, $start) or safe_die("Couldn't get surveys<br />{$dtquery}<br />" . $connect->ErrorMsg());
 } else {
     $dtresult = db_execute_assoc($dtquery) or safe_die("Couldn't get surveys<br />{$dtquery}<br />" . $connect->ErrorMsg());
 }
 $dtcount2 = $dtresult->RecordCount();
 $cells = $fncount + 1;
 //CONTROL MENUBAR
 $last = $start - $limit;
 $next = $start + $limit;
 $end = $dtcount - $limit;
 if ($end < 0) {
     $end = 0;
 }
 if ($last < 0) {
     $last = 0;
 }
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:31,代码来源:browse.php

示例5: count

 //Getting a count of questions for this survey
 $sumresult3 = $connect->Execute($sumquery3);
 //Checked
 $sumcount3 = $sumresult3->RecordCount();
 $sumquery6 = "SELECT count(*) FROM " . db_table_name('conditions') . " as c, " . db_table_name('questions') . " as q WHERE c.qid = q.qid AND q.sid={$surveyid}";
 //Getting a count of conditions for this survey
 $sumcount6 = $connect->GetOne($sumquery6);
 //Checked
 $sumquery2 = "SELECT * FROM " . db_table_name('groups') . " WHERE sid={$surveyid} AND language='" . $baselang . "'";
 //Getting a count of groups for this survey
 $sumresult2 = $connect->Execute($sumquery2);
 //Checked
 $sumcount2 = $sumresult2->RecordCount();
 $sumquery1 = "SELECT * FROM " . db_table_name('surveys') . " inner join " . db_table_name('surveys_languagesettings') . " on (surveyls_survey_id=sid and surveyls_language=language) WHERE sid={$surveyid}";
 //Getting data for this survey
 $sumresult1 = db_select_limit_assoc($sumquery1, 1);
 //Checked
 if ($sumresult1->RecordCount() == 0) {
     die('Invalid survey id');
 }
 //  if surveyid is invalid then die to prevent errors at a later time
 // Output starts here...
 $surveysummary = "";
 $surveyinfo = $sumresult1->FetchRow();
 $surveyinfo = array_map('FlattenText', $surveyinfo);
 //$surveyinfo = array_map('htmlspecialchars', $surveyinfo);
 $activated = $surveyinfo['active'];
 ////////////////////////////////////////////////////////////////////////
 // SURVEY MENU BAR
 ////////////////////////////////////////////////////////////////////////
 $surveysummary .= "" . "<div class='menubar surveybar'>\n" . "<div class='menubar-title ui-widget-header'>\n" . "<strong>" . $clang->gT("Survey") . "</strong> " . "<span class='basic'>{$surveyinfo['surveyls_title']} (" . $clang->gT("ID") . ":{$surveyid})</span></div>\n" . "<div class='menubar-main'>\n" . "<div class='menubar-left'>\n";
开发者ID:himanshu12k,项目名称:ce-www,代码行数:31,代码来源:html.php

示例6: GetSessionUserRights

function GetSessionUserRights($loginID)
{
    global $dbprefix, $connect;
    $squery = "SELECT create_survey, configurator, create_user, delete_user, superadmin, manage_template, manage_label FROM {$dbprefix}users WHERE uid={$loginID}";
    $sresult = db_execute_assoc($squery);
    //Checked
    if ($sresult->RecordCount() > 0) {
        $fields = $sresult->FetchRow();
        $_SESSION['USER_RIGHT_CREATE_SURVEY'] = $fields['create_survey'];
        $_SESSION['USER_RIGHT_CONFIGURATOR'] = $fields['configurator'];
        $_SESSION['USER_RIGHT_CREATE_USER'] = $fields['create_user'];
        $_SESSION['USER_RIGHT_DELETE_USER'] = $fields['delete_user'];
        $_SESSION['USER_RIGHT_SUPERADMIN'] = $fields['superadmin'];
        $_SESSION['USER_RIGHT_MANAGE_TEMPLATE'] = $fields['manage_template'];
        $_SESSION['USER_RIGHT_MANAGE_LABEL'] = $fields['manage_label'];
    }
    // SuperAdmins
    // * original superadmin with uid=1 unless manually changed and defined
    //   in config-defaults.php
    // * or any user having USER_RIGHT_SUPERADMIN right
    // Let's check if I am the Initial SuperAdmin
    $adminquery = "SELECT uid FROM {$dbprefix}users WHERE parent_id=0";
    $adminresult = db_select_limit_assoc($adminquery, 1);
    $row = $adminresult->FetchRow();
    if ($row['uid'] == $_SESSION['loginID']) {
        $initialSuperadmin = true;
    } else {
        $initialSuperadmin = false;
    }
    if ($initialSuperadmin === true) {
        $_SESSION['USER_RIGHT_SUPERADMIN'] = 1;
        $_SESSION['USER_RIGHT_INITIALSUPERADMIN'] = 1;
    } else {
        $_SESSION['USER_RIGHT_INITIALSUPERADMIN'] = 0;
    }
}
开发者ID:ddrmoscow,项目名称:queXS,代码行数:36,代码来源:sessioncontrol.php

示例7: surveyFixQuestionNumbering

/**
 * Fixes the question numbering of a single question inorder to
 * prevent column name conflicts
 *
 * @param none
 * @return bool
 */
function surveyFixQuestionNumbering($qid)
{
    global $dbprefix, $connect;
    //Fix a question id - requires renumbering a question
    $oldqid = $_GET['fixnumbering'];
    $query = "SELECT qid FROM {$dbprefix}questions ORDER BY qid DESC";
    $result = db_select_limit_assoc($query, 1) or safe_die($query . "<br />" . $connect->ErrorMsg());
    while ($row = $result->FetchRow()) {
        $lastqid = $row['qid'];
    }
    $newqid = $lastqid + 1;
    $query = "UPDATE {$dbprefix}questions SET qid={$newqid} WHERE qid={$oldqid}";
    $result = $connect->Execute($query) or safe_die($query . "<br />" . $connect->ErrorMsg());
    // Update subquestions
    $query = "UPDATE {$dbprefix}questions SET parent_qid={$newqid} WHERE parent_qid={$oldqid}";
    $result = $connect->Execute($query) or safe_die($query . "<br />" . $connect->ErrorMsg());
    //Update conditions.. firstly conditions FOR this question
    $query = "UPDATE {$dbprefix}conditions SET qid={$newqid} WHERE qid={$oldqid}";
    $result = $connect->Execute($query) or safe_die($query . "<br />" . $connect->ErrorMsg());
    //Now conditions based upon this question
    $query = "SELECT cqid, cfieldname FROM {$dbprefix}conditions WHERE cqid={$oldqid}";
    $result = db_execute_assoc($query) or safe_die($query . "<br />" . $connect->ErrorMsg());
    while ($row = $result->FetchRow()) {
        $switcher[] = array("cqid" => $row['cqid'], "cfieldname" => $row['cfieldname']);
    }
    if (isset($switcher)) {
        foreach ($switcher as $switch) {
            $query = "UPDATE {$dbprefix}conditions\r\n\t\t\t\t\t\t  SET cqid={$newqid},\r\n\t\t\t\t\t\t  cfieldname='" . str_replace("X" . $oldqid, "X" . $newqid, $switch['cfieldname']) . "'\r\n\t\t\t\t\t\t  WHERE cqid={$oldqid}";
            $result = $connect->Execute($query) or safe_die($query . "<br />" . $connect->ErrorMsg());
        }
    }
    //Now question_attributes
    $query = "UPDATE {$dbprefix}question_attributes SET qid={$newqid} WHERE qid={$oldqid}";
    $result = $connect->Execute($query) or safe_die($query . "<br />" . $connect->ErrorMsg());
    //Now answers
    $query = "UPDATE {$dbprefix}answers SET qid={$newqid} WHERE qid={$oldqid}";
    $result = $connect->Execute($query) or safe_die($query . "<br />" . $connect->ErrorMsg());
}
开发者ID:himanshu12k,项目名称:ce-www,代码行数:45,代码来源:surveytable_functions.php

示例8: emailSender

 /**
  *
  * Enter description here...
  * @param $surveyid
  * @param $type
  * @param $maxLsrcEmails
  * @return unknown_type
  */
 function emailSender($surveyid, $type, $maxLsrcEmails = '')
 {
     global $publicurl, $maxemails;
     global $connect, $sitename;
     global $dbprefix;
     $surveyid = sanitize_int($surveyid);
     include "lsrc.config.php";
     // wenn maxmails ber den lsrc gegeben wird das nutzen, ansonsten die default werte aus der config.php
     if ($maxLsrcEmails != '') {
         $maxemails = $maxLsrcEmails;
     }
     switch ($type) {
         case "custom":
             break;
         case "invite":
             $this->debugLsrc("wir sind in " . __FUNCTION__ . " Line " . __LINE__ . ", START invite ");
             if (isset($surveyid) && getEmailFormat($surveyid) == 'html') {
                 $ishtml = true;
             } else {
                 $ishtml = false;
             }
             //$tokenoutput .= ("Sending Invitations");
             //if (isset($tokenid)) {$tokenoutput .= " (".("Sending to Token ID").":&nbsp;{$tokenid})";}
             //$tokenoutput .= "\n";
             $this->debugLsrc("wir sind in " . __FUNCTION__ . " Line " . __LINE__ . ", {$surveyid}, {$type}");
             // Texte für Mails aus der Datenbank holen und in die POST Dinger schreiben. Nicht schön aber praktikabel
             $sql = "SELECT surveyls_language, surveyls_email_invite_subj, surveyls_email_invite  " . "FROM {$dbprefix}surveys_languagesettings " . "WHERE surveyls_survey_id = " . $surveyid . " ";
             //GET SURVEY DETAILS
             $thissurvey = getSurveyInfo($surveyid);
             //				$connect->SetFetchMode(ADODB_FETCH_ASSOC);
             //				$sqlResult=$connect->Execute($sql);
             $sqlResult = db_execute_assoc($sql);
             $this->debugLsrc("wir sind in " . __FUNCTION__ . " Line " . __LINE__ . ", invite ");
             while ($languageRow = $sqlResult->FetchRow()) {
                 $_POST['message_' . $languageRow['surveyls_language']] = $languageRow['surveyls_email_invite'];
                 $_POST['subject_' . $languageRow['surveyls_language']] = $languageRow['surveyls_email_invite_subj'];
             }
             //				if (isset($_POST['bypassbademails']) && $_POST['bypassbademails'] == 'Y')
             //				{
             //					$SQLemailstatuscondition = " AND emailstatus = 'OK'";
             //				}
             //				else
             //				{
             //					$SQLemailstatuscondition = "";
             //				}
             $this->debugLsrc("wir sind in " . __FUNCTION__ . " Line " . __LINE__ . ", invite ");
             $ctquery = "SELECT * FROM " . db_table_name("tokens_{$surveyid}") . " WHERE ((completed ='N') or (completed='')) AND ((sent ='N') or (sent='')) AND emailstatus = 'OK' ";
             if (isset($tokenid)) {
                 $ctquery .= " AND tid='{$tokenid}'";
             }
             //$tokenoutput .= "<!-- ctquery: $ctquery -->\n";
             $ctresult = $connect->Execute($ctquery);
             $ctcount = $ctresult->RecordCount();
             $ctfieldcount = $ctresult->FieldCount();
             $emquery = "SELECT * ";
             //if ($ctfieldcount > 7) {$emquery .= ", attribute_1, attribute_2";}
             $this->debugLsrc("wir sind in " . __FUNCTION__ . " Line " . __LINE__ . ", invite ");
             $emquery .= " FROM " . db_table_name("tokens_{$surveyid}") . " WHERE ((completed ='N') or (completed='')) AND ((sent ='N') or (sent=''))  AND emailstatus = 'OK' ";
             if (isset($tokenid)) {
                 $emquery .= " and tid='{$tokenid}'";
             }
             //$tokenoutput .= "\n\n<!-- emquery: $emquery -->\n\n";
             $emresult = db_select_limit_assoc($emquery, $maxemails);
             $emcount = $emresult->RecordCount();
             //$tokenoutput .= "<table width='500px' align='center' >\n"
             ////."\t<tr>\n"
             //."\t\t<td><font size='1'>\n";
             $surveylangs = GetAdditionalLanguagesFromSurveyID($surveyid);
             $baselanguage = GetBaseLanguageFromSurveyID($surveyid);
             array_unshift($surveylangs, $baselanguage);
             $this->debugLsrc("wir sind in " . __FUNCTION__ . " Line " . __LINE__ . ", invite ");
             foreach ($surveylangs as $language) {
                 $_POST['message_' . $language] = auto_unescape($_POST['message_' . $language]);
                 $_POST['subject_' . $language] = auto_unescape($_POST['subject_' . $language]);
                 if ($ishtml) {
                     $_POST['message_' . $language] = html_entity_decode($_POST['message_' . $language], ENT_QUOTES, $emailcharset);
                 }
             }
             $this->debugLsrc("wir sind in " . __FUNCTION__ . " Line " . __LINE__ . ", invite ");
             if ($emcount > 0) {
                 $mailsSend = 0;
                 while ($emrow = $emresult->FetchRow()) {
                     $c = 1;
                     unset($fieldsarray);
                     $to = $emrow['email'];
                     $fieldsarray["{EMAIL}"] = $emrow['email'];
                     $fieldsarray["{FIRSTNAME}"] = $emrow['firstname'];
                     $fieldsarray["{LASTNAME}"] = $emrow['lastname'];
                     $fieldsarray["{TOKEN}"] = $emrow['token'];
                     $fieldsarray["{LANGUAGE}"] = $emrow['language'];
                     while (isset($emrow["attribute_{$c}"])) {
                         $fieldsarray["{ATTRIBUTE_{$c}}"] = $emrow["attribute_{$c}"];
//.........这里部分代码省略.........
开发者ID:rkaldung,项目名称:LimeSurvey,代码行数:101,代码来源:lsrc.helper.php

示例9: fixSubquestions

/**
* This function fixes the group ID and type on all subquestions
*
*/
function fixSubquestions()
{
    $surveyidresult = db_select_limit_assoc("select sq.qid, sq.parent_qid, sq.gid as sqgid, q.gid, sq.type as sqtype, q.type\r\n    from " . db_table_name('questions') . " sq JOIN " . db_table_name('questions') . " q on sq.parent_qid=q.qid\r\n    where sq.parent_qid>0 and  (sq.gid!=q.gid or sq.type!=q.type)", 1000);
    while ($sv = $surveyidresult->FetchRow()) {
        db_execute_assoc('update ' . db_table_name('questions') . " set type='{$sv['type']}', gid={$sv['gid']} where qid={$sv['qid']}");
    }
}
开发者ID:himanshu12k,项目名称:ce-www,代码行数:11,代码来源:common_functions.php

示例10: db_execute_assoc

                    . "{$crow['description']}</font></td></tr>\n"
                    . "</table>";
                }


                $eguquery = "SELECT * FROM ".db_table_name("user_in_groups")." AS a INNER JOIN ".db_table_name("users")." AS b ON a.uid = b.uid WHERE ugid = " . $ugid . " ORDER BY b.users_name";
                $eguresult = db_execute_assoc($eguquery); //Checked
                $usergroupsummary .= "<table class='users'>\n"
                . "<thead><tr>\n"
                . "<th>".$clang->gT("Action")."</th>\n"
                . "<th>".$clang->gT("Username")."</th>\n"
                . "<th>".$clang->gT("Email")."</th>\n"
                . "</tr></thead><tbody>\n";

                $query2 = "SELECT ugid FROM ".db_table_name('user_groups')." WHERE ugid = ".$ugid." AND owner_id = ".$_SESSION['loginID'];
                $result2 = db_select_limit_assoc($query2, 1);
                $row2 = $result2->FetchRow();

                $row = 1;
                $usergroupentries='';
                while ($egurow = $eguresult->FetchRow())
                {
                    if (!isset($bgcc)) {$bgcc="evenrow";}
                    else
                    {
                        if ($bgcc == "evenrow") {$bgcc = "oddrow";}
                        else {$bgcc = "evenrow";}
                    }

                    if($egurow['uid'] == $crow['owner_id'])
                    {
开发者ID:nmklong,项目名称:limesurvey-cdio3,代码行数:31,代码来源:userrighthandling.php

示例11: setcookie

    //DELETE COOKIE (allow to use multiple times)
    setcookie($cookiename, "INCOMPLETE", time() - 120);
    //echo "Reset Cookie!";
}
//Check to see if a refering URL has been captured.
GetReferringUrl();
// Let's do this only if
//  - a saved answer record hasn't been loaded through the saved feature
//  - the survey is not anonymous
//  - the survey is active
//  - a token information has been provided
//  - the survey is setup to allow token-response-persistence
if ($thissurvey['tokenanswerspersistence'] == 'Y' && !isset($_SESSION['srid']) && $thissurvey['anonymized'] == "N" && $thissurvey['active'] == "Y" && isset($token) && $token != '') {
    // load previous answers if any (dataentry with nosubmit)
    $srquery = "SELECT id,submitdate FROM {$thissurvey['tablename']}" . " WHERE {$thissurvey['tablename']}.token='" . db_quote($token) . "' order by id desc";
    $result = db_select_limit_assoc($srquery, 1);
    if ($result->RecordCount() > 0) {
        $row = $result->FetchRow();
        if ($row['submitdate'] == '' || $row['submitdate'] != '' && $thissurvey['alloweditaftercompletion'] == 'Y') {
            $_SESSION['srid'] = $row['id'];
        }
    }
    buildsurveysession();
    loadanswers();
}
// SAVE POSTED ANSWERS TO DATABASE IF MOVE (NEXT,PREV,LAST, or SUBMIT) or RETURNING FROM SAVE FORM
if (isset($move) || isset($_POST['saveprompt'])) {
    require_once "save.php";
    // RELOAD THE ANSWERS INCASE SOMEONE ELSE CHANGED THEM
    if ($thissurvey['active'] == "Y" && ($thissurvey['allowsave'] == "Y" || $thissurvey['tokenanswerspersistence'] == "Y")) {
        loadanswers();
开发者ID:karime7gezly,项目名称:OpenConextApps-LimeSurvey,代码行数:31,代码来源:index.php

示例12: generate_statistics


//.........这里部分代码省略.........
                    //filtering enabled?
                    if (incompleteAnsFilterstate() == "inc") {$querystarter .= " AND submitdate is null";}
                    elseif (incompleteAnsFilterstate() == "filter") {$querystarter .= " AND submitdate is not null";}

                    //if $sql values have been passed to the statistics script from another script, incorporate them
                    if ($sql != "NULL") {$querystarter .= " AND $sql";}

                    //we just count the number of records returned
                    $medcount=$result->RecordCount();

                    //put the total number of records at the beginning of this array
                    array_unshift($showem, array($statlang->gT("Count"), $medcount));


                    //no more comment from Mazi regarding the calculation

                    // Calculating only makes sense with more than one result
                    if ($medcount>1)
                    {
                        //1ST QUARTILE (Q1)
                        $q1=(1/4)*($medcount+1);
                        $q1b=(int)((1/4)*($medcount+1));
                        $q1c=$q1b-1;
                        $q1diff=$q1-$q1b;
                        $total=0;

                        // fix if there are too few values to evaluate.
                        if ($q1c<0) {$q1c=0;}

                        if ($q1 != $q1b)
                        {
                            //ODD NUMBER
                            $query = $querystarter . " ORDER BY ".db_quote_id($fieldname)."*1 ";
                            $result=db_select_limit_assoc($query, 2, $q1c) or safe_die("1st Quartile query failed<br />".$connect->ErrorMsg());

                            while ($row=$result->FetchRow())
                            {
                                if ($total == 0)    {$total=$total-$row[$fieldname];}

                                else                {$total=$total+$row[$fieldname];}

                                $lastnumber=$row[$fieldname];
                            }

                            $q1total=$lastnumber-((1-$q1diff)*$total);

                            if ($q1total < $minimum) {$q1total=$minimum;}

                            $showem[]=array($statlang->gT("1st quartile (Q1)"), $q1total);
                        }
                        else
                        {
                            //EVEN NUMBER
                            $query = $querystarter . " ORDER BY ".db_quote_id($fieldname)."*1 ";
                            $result=db_select_limit_assoc($query,1, $q1c) or safe_die ("1st Quartile query failed<br />".$connect->ErrorMsg());

                            while ($row=$result->FetchRow())
                            {
                                $showem[]=array($statlang->gT("1st quartile (Q1)"), $row[$fieldname]);
                            }
                        }

                        $total=0;


                        //MEDIAN (Q2)
开发者ID:nmklong,项目名称:limesurvey-cdio3,代码行数:67,代码来源:statistics_function.php

示例13: die

         $deactivateresult = $connect->Execute($deactivatequery) or die("Could not rename the old sequence for this token table. The database reported the following error:<br />" . htmlspecialchars($connect->ErrorMsg()) . "<br /><br /><a href='{$scriptname}?sid={$postsid}'>" . $clang->gT("Main Admin Screen") . "</a>");
         $setsequence = "ALTER TABLE " . db_table_name_nq($tnewtable) . " ALTER COLUMN tid SET DEFAULT nextval('" . db_table_name_nq($tnewtable) . "_tid_seq'::regclass);";
         $deactivateresult = $connect->Execute($setsequence) or die("Could not alter the field 'tid' to point to the new sequence name for this token table. The database reported the following error:<br />" . htmlspecialchars($connect->ErrorMsg()) . "<br /><br />Survey was not deactivated either.<br /><br /><a href='{$scriptname}?sid={$postsid}'>" . $clang->gT("Main Admin Screen") . "</a>");
         $setidx = "ALTER INDEX " . db_table_name_nq($toldtable) . "_idx RENAME TO " . db_table_name_nq($tnewtable) . "_idx;";
         $deactivateresult = $connect->Execute($setidx) or die("Could not alter the index for this token table. The database reported the following error:<br />" . htmlspecialchars($connect->ErrorMsg()) . "<br /><br />Survey was not deactivated either.<br /><br /><a href='{$scriptname}?sid={$_GET['sid']}'>" . $clang->gT("Main Admin Screen") . "</a>");
     }
 }
 // IF there are any records in the saved_control table related to this survey, they have to be deleted
 $query = "DELETE FROM {$dbprefix}saved_control WHERE sid={$postsid}";
 $result = $connect->Execute($query);
 $oldtable = "{$dbprefix}survey_{$postsid}";
 $newtable = "{$dbprefix}old_survey_{$postsid}_{$date}";
 //Update the auto_increment value from the table before renaming
 $new_autonumber_start = 0;
 $query = "SELECT id FROM {$oldtable} ORDER BY id desc";
 $result = db_select_limit_assoc($query, 1, -1, false, false);
 if ($result) {
     while ($row = $result->FetchRow()) {
         if (strlen($row['id']) > 12) {
             $part1 = substr($row['id'], 0, 12);
             $part2len = strlen($row['id']) - 12;
             $part2 = sprintf("%0{$part2len}d", substr($row['id'], 12, strlen($row['id']) - 12) + 1);
             $new_autonumber_start = "{$part1}{$part2}";
         } else {
             $new_autonumber_start = $row['id'] + 1;
         }
     }
 }
 $query = "UPDATE {$dbprefix}surveys SET autonumber_start={$new_autonumber_start} WHERE sid={$surveyid}";
 @($result = $connect->Execute($query));
 //Note this won't die if it fails - that's deliberate.
开发者ID:himanshu12k,项目名称:ce-www,代码行数:31,代码来源:deactivate.php

示例14: showTranslateAdminmenu

/**
 * showTranslateAdminmenu() creates the main menu options for the survey translation page
 * @param string $surveyid The survey ID
 * @param string $survey_title 
 * @param string $tolang
 * @param string $activated
 * @param string $scriptname
 * @global string $imageurl, $clang, $publicurl
 * @return string
 */
function showTranslateAdminmenu($surveyid, $survey_title, $tolang, $scriptname)
{
    global $imageurl, $clang, $publicurl;
    $baselang = GetBaseLanguageFromSurveyID($surveyid);
    $supportedLanguages = getLanguageData(false);
    $langs = GetAdditionalLanguagesFromSurveyID($surveyid);
    $adminmenu = "" . "<div class='menubar'>\n" . "<div class='menubar-title ui-widget-header'>\n" . "<strong>" . $clang->gT("Translate survey") . ": {$survey_title}</strong>\n" . "</div>\n" . "<div class='menubar-main'>\n";
    $adminmenu .= "" . "<div class='menubar-left'>\n";
    // Return to survey administration button
    $adminmenu .= menuItem($clang->gT("Return to survey administration"), $clang->gTview("Return to survey administration"), "Administration", "home.png", "{$scriptname}?sid={$surveyid}");
    // Separator
    $adminmenu .= menuSeparator();
    // Test / execute survey button
    if ($tolang != "") {
        $sumquery1 = "SELECT * FROM " . db_table_name('surveys') . " inner join " . db_table_name('surveys_languagesettings') . " on (surveyls_survey_id=sid and surveyls_language=language) WHERE sid={$surveyid}";
        //Getting data for this survey
        $sumresult1 = db_select_limit_assoc($sumquery1, 1);
        //Checked
        $surveyinfo = $sumresult1->FetchRow();
        $surveyinfo = array_map('FlattenText', $surveyinfo);
        $activated = $surveyinfo['active'];
        if ($activated == "N") {
            $menutext = $clang->gT("Test This Survey");
            $menutext2 = $clang->gTview("Test This Survey");
        } else {
            $menutext = $clang->gT("Execute This Survey");
            $menutext2 = $clang->gTview("Execute This Survey");
        }
        if (count(GetAdditionalLanguagesFromSurveyID($surveyid)) == 0) {
            $adminmenu .= menuItem($menutext, $menutext2, "do.png", "{$publicurl}/index.php?sid={$surveyid}&amp;newtest=Y&amp;lang={$baselang}");
        } else {
            $icontext = $clang->gT($menutext);
            $icontext2 = $clang->gT($menutext);
            $adminmenu .= "<a href='#' id='dosurvey' class='dosurvey'" . "title=\"" . $icontext2 . "\" accesskey='d'>" . "<img  src='{$imageurl}/do.png' alt='{$icontext}' />" . "</a>\n";
            $tmp_survlangs = GetAdditionalLanguagesFromSurveyID($surveyid);
            $tmp_survlangs[] = $baselang;
            rsort($tmp_survlangs);
            // Test Survey Language Selection Popup
            $adminmenu .= "<div class=\"langpopup\" id=\"dosurveylangpopup\">" . $clang->gT("Please select a language:") . "<ul>";
            foreach ($tmp_survlangs as $tmp_lang) {
                $adminmenu .= "<li><a accesskey='d' onclick=\"\$('.dosurvey').qtip('hide');" . "\" target='_blank' href='{$publicurl}/index.php?sid={$surveyid}&amp;" . "newtest=Y&amp;lang={$tmp_lang}'>" . getLanguageNameFromCode($tmp_lang, false) . "</a></li>";
            }
            $adminmenu .= "</ul></div>";
        }
    }
    // End of survey-bar-left
    $adminmenu .= "</div>";
    // Survey language list
    $selected = "";
    if (!isset($tolang)) {
        $selected = " selected='selected' ";
    }
    $adminmenu .= "" . "<div class='menubar-right'>\n" . "<span class=\"boxcaption\">" . $clang->gT("Translate to") . ":</span>" . "<select onchange=\"window.open(this.options[this.selectedIndex].value,'_top')\">\n";
    if (count(GetAdditionalLanguagesFromSurveyID($surveyid)) > 1) {
        $adminmenu .= "<option {$selected} value='{$scriptname}?action=translate&amp;sid={$surveyid}'>" . $clang->gT("Please choose...") . "</option>\n";
    }
    foreach ($langs as $lang) {
        $selected = "";
        if ($tolang == $lang) {
            $selected = " selected='selected' ";
        }
        $tolangtext = $supportedLanguages[$lang]['description'];
        $adminmenu .= "<option {$selected} value='{$scriptname}?action=translate&amp;sid={$surveyid}&amp;tolang={$lang}'> " . $tolangtext . " </option>\n";
    }
    $adminmenu .= "" . "</select>\n" . "</div>\n";
    // End of menubar-right
    $adminmenu .= "" . "</div>\n";
    $adminmenu .= "" . "</div>\n";
    return $adminmenu;
}
开发者ID:karime7gezly,项目名称:OpenConextApps-LimeSurvey,代码行数:80,代码来源:translate_functions.php


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