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


PHP db_table_name_nq函数代码示例

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


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

示例1: db_table_name

//CHECK IF SURVEY IS ACTIVATED AND EXISTS
$actquery = "SELECT * FROM " . db_table_name('surveys') . " as a inner join " . db_table_name('surveys_languagesettings') . " as b on (b.surveyls_survey_id=a.sid and b.surveyls_language=a.language) WHERE a.sid={$surveyid}";
$actresult = db_execute_assoc($actquery);
$actcount = $actresult->RecordCount();
if ($actcount > 0) {
    while ($actrow = $actresult->FetchRow()) {
        $surveytable = db_table_name("survey_" . $actrow['sid']);
        $surveytimingstable = db_table_name("survey_" . $actrow['sid'] . "_timings");
        $tokentable = $dbprefix . "tokens_" . $actrow['sid'];
        /*
         * DO NEVER EVER PUT VARIABLES AND FUNCTIONS WHICH GIVE BACK DIFFERENT QUOTES
         * IN DOUBLE QUOTED(' and " and \" is used) JAVASCRIPT/HTML CODE!!! (except for: you know what you are doing)
         *
         * Used for deleting a record, fix quote bugs..
         */
        $surveytableNq = db_table_name_nq("survey_" . $surveyid);
        $surveyname = "{$actrow['surveyls_title']}";
        if ($actrow['active'] == "N") {
            $browseoutput = "\t<div class='messagebox ui-corner-all'><div class='header ui-widget-header'>" . $clang->gT("Browse Responses") . "</div><div class='warningheader'>" . $clang->gT("Error") . "\t</div>\n" . $clang->gT("This survey has not been activated. There are no results to browse.") . "<br />\n" . "<input type='submit' value='" . $clang->gT("Main Admin Screen") . "' onclick=\"window.open('{$scriptname}?sid={$surveyid}', '_top')\" /><br />\n" . "</div>";
            return;
        }
    }
} else {
    $browseoutput = "\t<div class='messagebox ui-corner-all'><div class='header ui-widget-header'>" . $clang->gT("Browse Responses") . "</div><div class='warningheader'>" . $clang->gT("Error") . "\t</div>\n" . $clang->gT("There is no matching survey.") . "<br />\n" . "<input type='submit' value='" . $clang->gT("Main Admin Screen") . "' onclick=\"window.open('{$scriptname}', '_top')\" /><br />\n" . "</div>";
    return;
}
//OK. IF WE GOT THIS FAR, THEN THE SURVEY EXISTS AND IT IS ACTIVE, SO LETS GET TO WORK.
$surveyinfo = getSurveyInfo($surveyid);
require_once dirname(__FILE__) . '/sessioncontrol.php';
// Set language for questions and labels to base language of this survey
if (isset($browselang) && $browselang != '') {
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:31,代码来源:browse.php

示例2: safe_die

     $qquery = "SELECT sid FROM {$dbprefix}surveys WHERE sid='{$iSurveyID}'";
     $qresult = $connect->Execute($qquery) or safe_die("Couldn't check survey table for sid<br />{$qquery}<br />" . $connect->ErrorMsg());
     $qcount = $qresult->RecordCount();
     if ($qcount == 0) {
         $date = date('YmdHis') . rand(1, 1000);
         $sOldTable = "tokens_{$iSurveyID}";
         $sNewTable = "old_tokens_{$iSurveyID}_{$date}";
         $deactivatequery = db_rename_table(db_table_name_nq($sOldTable), db_table_name_nq($sNewTable));
         if ($databasetype == 'postgres') {
             // If you deactivate a postgres table you have to rename the according sequence too and alter the id field to point to the changed sequence
             $sOldTableJur = db_table_name_nq($sOldTable);
             $deactivatequery = db_rename_table(db_table_name_nq($sOldTable), db_table_name_nq($sNewTable) . '_tid_seq');
             $deactivateresult = $connect->Execute($deactivatequery) or die("oldtable : " . $sOldTable . " / oldtableJur : " . $sOldTableJur . " / " . htmlspecialchars($deactivatequery) . " / 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={$_GET['sid']}'>" . $clang->gT("Main Admin Screen") . "</a>");
             $setsequence = "ALTER TABLE " . db_table_name_nq($sNewTable) . "_tid_seq ALTER COLUMN tid SET DEFAULT nextval('" . db_table_name_nq($sNewTable) . "_tid_seq'::regclass);";
             $deactivateresult = $connect->Execute($setsequence) or die(htmlspecialchars($setsequence) . " 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={$_GET['sid']}'>" . $clang->gT("Main Admin Screen") . "</a>");
             $setidx = "ALTER INDEX " . db_table_name_nq($sOldTable) . "_idx RENAME TO " . db_table_name_nq($sNewTable) . "_idx;";
             $deactivateresult = $connect->Execute($setidx) or die(htmlspecialchars($setidx) . " 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>");
         } else {
             $deactivateresult = $connect->Execute($deactivatequery) or die("Couldn't deactivate because:<br />\n" . htmlspecialchars($connect->ErrorMsg()) . " - Query: " . htmlspecialchars($deactivatequery) . " <br /><br />\n<a href='{$scriptname}?sid={$surveyid}'>Admin</a>\n");
         }
     }
 }
 /**********************************************************************/
 /*     CHECK CONDITIONS                                               */
 /**********************************************************************/
 $query = "SELECT * FROM {$dbprefix}conditions ORDER BY cid";
 $result = db_execute_assoc($query) or safe_die("Couldn't get list of conditions from database<br />{$query}<br />" . $connect->ErrorMsg());
 while ($row = $result->FetchRow()) {
     $qquery = "SELECT qid FROM {$dbprefix}questions WHERE qid='{$row['qid']}'";
     $qresult = $connect->Execute($qquery) or safe_die("Couldn't check questions table for qids<br />{$qquery}<br />" . $connect->ErrorMsg());
     $qcount = $qresult->RecordCount();
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:31,代码来源:integritycheck.php

示例3: safe_die

 $isquery = $connect->GetInsertSQL($dbtablename, $insertarray);
 $isresult = $connect->Execute($isquery) or safe_die($isquery . "<br />" . $connect->ErrorMsg());
 // Checked
 // Fix bug with FCKEditor saving strange BR types
 $_POST['surveyls_title'] = fix_FCKeditor_text($_POST['surveyls_title']);
 $_POST['description'] = fix_FCKeditor_text($_POST['description']);
 $_POST['welcome'] = fix_FCKeditor_text($_POST['welcome']);
 $bplang = new limesurvey_lang($_POST['language']);
 $aDefaultTexts = aTemplateDefaultTexts($bplang, 'unescaped');
 $is_html_email = false;
 if (isset($_POST['htmlemail']) && $_POST['htmlemail'] == "Y") {
     $is_html_email = true;
     $aDefaultTexts['admin_detailed_notification'] = $aDefaultTexts['admin_detailed_notification_css'] . conditional_nl2br($aDefaultTexts['admin_detailed_notification'], $is_html_email, 'unescaped');
 }
 $insertarray = array('surveyls_survey_id' => $surveyid, 'surveyls_language' => $_POST['language'], 'surveyls_title' => $_POST['surveyls_title'], 'surveyls_description' => $_POST['description'], 'surveyls_welcometext' => $_POST['welcome'], 'surveyls_urldescription' => $_POST['urldescrip'], 'surveyls_endtext' => $_POST['endtext'], 'surveyls_url' => $_POST['url'], 'surveyls_email_invite_subj' => $aDefaultTexts['invitation_subject'], 'surveyls_email_invite' => conditional_nl2br($aDefaultTexts['invitation'], $is_html_email, 'unescaped'), 'surveyls_email_remind_subj' => $aDefaultTexts['reminder_subject'], 'surveyls_email_remind' => conditional_nl2br($aDefaultTexts['reminder'], $is_html_email, 'unescaped'), 'surveyls_email_confirm_subj' => $aDefaultTexts['confirmation_subject'], 'surveyls_email_confirm' => conditional_nl2br($aDefaultTexts['confirmation'], $is_html_email, 'unescaped'), 'surveyls_email_register_subj' => $aDefaultTexts['registration_subject'], 'surveyls_email_register' => conditional_nl2br($aDefaultTexts['registration'], $is_html_email, 'unescaped'), 'email_admin_notification_subj' => $aDefaultTexts['admin_notification_subject'], 'email_admin_notification' => conditional_nl2br($aDefaultTexts['admin_notification'], $is_html_email, 'unescaped'), 'email_admin_responses_subj' => $aDefaultTexts['admin_detailed_notification_subject'], 'email_admin_responses' => $aDefaultTexts['admin_detailed_notification'], 'surveyls_dateformat' => $_POST['dateformat'], 'surveyls_numberformat' => $numberformatid);
 $dbtablename = db_table_name_nq('surveys_languagesettings');
 $isquery = $connect->GetInsertSQL($dbtablename, $insertarray);
 $isresult = $connect->Execute($isquery) or safe_die($isquery . "<br />" . $connect->ErrorMsg());
 // Checked
 unset($bplang);
 $_SESSION['flashmessage'] = $clang->gT("Survey was successfully added.");
 // Update survey permissions
 GiveAllSurveyPermissions($_SESSION['loginID'], $surveyid);
 LimeExpressionManager::SetSurveyId($surveyid);
 $surveyselect = getsurveylist();
 // Create initial Survey table
 //include("surveytable_functions.php");
 //$creationResult = surveyCreateTable($surveyid);
 // Survey table could not be created
 //if ($creationResult !== true)
 //{
开发者ID:ddrmoscow,项目名称:queXS,代码行数:31,代码来源:database.php

示例4: returnglobal

 }
 if (!isset($subaction)) {
     $subaction = returnglobal('subaction');
 }
 if (!isset($quotasoutput)) {
     $quotasoutput = "";
 }
 //if (!isset($_POST['autoload_url']) || empty($_POST['autoload_url'])) {$_POST['autoload_url']=0;} //queXS Removal
 if ($subaction == "insertquota" && bHasSurveyPermission($surveyid, 'quotas', 'create')) {
     if (!isset($_POST['quota_limit']) || $_POST['quota_limit'] < 0 || empty($_POST['quota_limit']) || !is_numeric($_POST['quota_limit'])) {
         $_POST['quota_limit'] = 0;
     }
     array_walk($_POST, 'db_quote', true);
     $query = "INSERT INTO " . db_table_name('quota') . " (sid,name,qlimit,action,autoload_url)\n            VALUES ('{$surveyid}','{$_POST['quota_name']}','{$_POST['quota_limit']}','1', '1')";
     $connect->Execute($query) or safe_die("Error inserting limit" . $connect->ErrorMsg());
     $quotaid = $connect->Insert_Id(db_table_name_nq('quota'), "id");
     //Get the languages used in this survey
     $langs = GetAdditionalLanguagesFromSurveyID($surveyid);
     $baselang = GetBaseLanguageFromSurveyID($surveyid);
     array_push($langs, $baselang);
     //Iterate through each language, and make sure there is a quota message for it
     $errorstring = '';
     foreach ($langs as $lang) {
         if (!$_POST['quotals_message_' . $lang]) {
             $errorstring .= GetLanguageNameFromCode($lang, false) . "\\n";
         }
     }
     if ($errorstring != '') {
         $databaseoutput .= "<script type=\"text/javascript\">\n<!--\n alert(\"" . $clang->gT("Quota could not be added.\\n\\nIt is missing a quota message for the following languages", "js") . ":\\n" . $errorstring . "\")\n //-->\n</script>\n";
     } else {
         require_once "../classes/inputfilter/class.inputfilter_clean.php";
开发者ID:ddrmoscow,项目名称:queXS,代码行数:31,代码来源:quota.php

示例5: array_diff

 // Only import fields not being in the $dontimportfields array
 $aValidFields = array_diff($aValidFields, $dontimportfields);
 $queryOldValues = "SELECT " . implode(", ", array_map("db_quote_id", $aValidFields)) . " FROM {$oldtable} ";
 $resultOldValues = db_execute_assoc($queryOldValues) or safe_die("Error:<br />{$queryOldValues}<br />" . $connect->ErrorMsg());
 $iRecordCount = $resultOldValues->RecordCount();
 $aSRIDConversions = array();
 while ($row = $resultOldValues->FetchRow()) {
     $iOldID = $row['id'];
     unset($row['id']);
     $sInsertSQL = "INSERT into {$activetable} (" . implode(",", array_map("db_quote_id", array_keys($row))) . ") VALUES (" . implode(",", array_map("db_quoteall", array_values($row))) . ")";
     $result = $connect->Execute($sInsertSQL) or safe_die("Error:<br />{$sInsertSQL}<br />" . $connect->ErrorMsg());
     $aSRIDConversions[$iOldID] = $connect->Insert_Id($activetable, "id");
 }
 $_SESSION['flashmessage'] = sprintf($clang->gT("%s old response(s) were successfully imported."), $iRecordCount);
 $sOldTimingsTable = substr($oldtable, 0, strrpos($oldtable, '_')) . '_timings' . substr($oldtable, strrpos($oldtable, '_'));
 $sNewTimingsTable = db_table_name_nq("survey_{$surveyid}_timings");
 if (tableExists(sStripDBPrefix($sOldTimingsTable)) && tableExists(sStripDBPrefix($sNewTimingsTable)) && returnglobal('importtimings') == 'Y') {
     // Import timings
     $aFieldsOldTimingTable = array_values($connect->MetaColumnNames($sOldTimingsTable, true));
     $aFieldsNewTimingTable = array_values($connect->MetaColumnNames($sNewTimingsTable, true));
     $aValidTimingFields = array_intersect($aFieldsOldTimingTable, $aFieldsNewTimingTable);
     $queryOldValues = "SELECT " . implode(", ", $aValidTimingFields) . " FROM {$sOldTimingsTable} ";
     $resultOldValues = db_execute_assoc($queryOldValues) or safe_die("Error:<br />{$queryOldValues}<br />" . $connect->ErrorMsg());
     $iRecordCountT = $resultOldValues->RecordCount();
     $aSRIDConversions = array();
     while ($row = $resultOldValues->FetchRow()) {
         if (isset($aSRIDConversions[$row['id']])) {
             $row['id'] = $aSRIDConversions[$row['id']];
         }
         $sInsertSQL = "INSERT into {$sNewTimingsTable} (" . implode(",", array_map("db_quote_id", array_keys($row))) . ") VALUES (" . implode(",", array_map("db_quoteall", array_values($row))) . ")";
         $result = $connect->Execute($sInsertSQL) or safe_die("Error:<br />{$sInsertSQL}<br />" . $connect->ErrorMsg());
开发者ID:ddrmoscow,项目名称:queXS,代码行数:31,代码来源:importoldresponses.php

示例6: upgrade_surveypermissions_table145

function upgrade_surveypermissions_table145()
{
    global $modifyoutput, $connect;
    $sPermissionQuery = "SELECT * FROM " . db_table_name('surveys_rights');
    $oPermissionResult = db_execute_assoc($sPermissionQuery);
    if (!$oPermissionResult) {
        return "Database Error";
    } else {
        $tablename = db_table_name_nq('survey_permissions');
        while ($aPermissionRow = $oPermissionResult->FetchRow()) {
            $sPermissionInsertQuery = $connect->GetInsertSQL($tablename, array('permission' => 'assessments', 'create_p' => $aPermissionRow['define_questions'], 'read_p' => $aPermissionRow['define_questions'], 'update_p' => $aPermissionRow['define_questions'], 'delete_p' => $aPermissionRow['define_questions'], 'sid' => $aPermissionRow['sid'], 'uid' => $aPermissionRow['uid']));
            modify_database("", $sPermissionInsertQuery);
            echo $modifyoutput;
            flush();
            ob_flush();
            $sPermissionInsertQuery = $connect->GetInsertSQL($tablename, array('permission' => 'quotas', 'create_p' => $aPermissionRow['define_questions'], 'read_p' => $aPermissionRow['define_questions'], 'update_p' => $aPermissionRow['define_questions'], 'delete_p' => $aPermissionRow['define_questions'], 'sid' => $aPermissionRow['sid'], 'uid' => $aPermissionRow['uid']));
            modify_database("", $sPermissionInsertQuery);
            echo $modifyoutput;
            flush();
            ob_flush();
            $sPermissionInsertQuery = $connect->GetInsertSQL($tablename, array('permission' => 'responses', 'create_p' => $aPermissionRow['browse_response'], 'read_p' => $aPermissionRow['browse_response'], 'update_p' => $aPermissionRow['browse_response'], 'delete_p' => $aPermissionRow['delete_survey'], 'export_p' => $aPermissionRow['export'], 'import_p' => $aPermissionRow['browse_response'], 'sid' => $aPermissionRow['sid'], 'uid' => $aPermissionRow['uid']));
            modify_database("", $sPermissionInsertQuery);
            echo $modifyoutput;
            flush();
            ob_flush();
            $sPermissionInsertQuery = $connect->GetInsertSQL($tablename, array('permission' => 'statistics', 'read_p' => $aPermissionRow['browse_response'], 'sid' => $aPermissionRow['sid'], 'uid' => $aPermissionRow['uid']));
            modify_database("", $sPermissionInsertQuery);
            echo $modifyoutput;
            flush();
            ob_flush();
            $sPermissionInsertQuery = $connect->GetInsertSQL($tablename, array('permission' => 'survey', 'read_p' => 1, 'delete_p' => $aPermissionRow['delete_survey'], 'sid' => $aPermissionRow['sid'], 'uid' => $aPermissionRow['uid']));
            modify_database("", $sPermissionInsertQuery);
            echo $modifyoutput;
            flush();
            ob_flush();
            $sPermissionInsertQuery = $connect->GetInsertSQL($tablename, array('permission' => 'surveyactivation', 'update_p' => $aPermissionRow['activate_survey'], 'sid' => $aPermissionRow['sid'], 'uid' => $aPermissionRow['uid']));
            modify_database("", $sPermissionInsertQuery);
            echo $modifyoutput;
            flush();
            ob_flush();
            $sPermissionInsertQuery = $connect->GetInsertSQL($tablename, array('permission' => 'surveycontent', 'create_p' => $aPermissionRow['define_questions'], 'read_p' => $aPermissionRow['define_questions'], 'update_p' => $aPermissionRow['define_questions'], 'delete_p' => $aPermissionRow['define_questions'], 'export_p' => $aPermissionRow['export'], 'import_p' => $aPermissionRow['define_questions'], 'sid' => $aPermissionRow['sid'], 'uid' => $aPermissionRow['uid']));
            modify_database("", $sPermissionInsertQuery);
            echo $modifyoutput;
            flush();
            ob_flush();
            $sPermissionInsertQuery = $connect->GetInsertSQL($tablename, array('permission' => 'surveylocale', 'read_p' => $aPermissionRow['edit_survey_property'], 'update_p' => $aPermissionRow['edit_survey_property'], 'sid' => $aPermissionRow['sid'], 'uid' => $aPermissionRow['uid']));
            modify_database("", $sPermissionInsertQuery);
            echo $modifyoutput;
            flush();
            ob_flush();
            $sPermissionInsertQuery = $connect->GetInsertSQL($tablename, array('permission' => 'surveysettings', 'read_p' => $aPermissionRow['edit_survey_property'], 'update_p' => $aPermissionRow['edit_survey_property'], 'sid' => $aPermissionRow['sid'], 'uid' => $aPermissionRow['uid']));
            modify_database("", $sPermissionInsertQuery);
            echo $modifyoutput;
            flush();
            ob_flush();
            $sPermissionInsertQuery = $connect->GetInsertSQL($tablename, array('permission' => 'tokens', 'create_p' => $aPermissionRow['activate_survey'], 'read_p' => $aPermissionRow['activate_survey'], 'update_p' => $aPermissionRow['activate_survey'], 'delete_p' => $aPermissionRow['activate_survey'], 'export_p' => $aPermissionRow['export'], 'import_p' => $aPermissionRow['activate_survey'], 'sid' => $aPermissionRow['sid'], 'uid' => $aPermissionRow['uid']));
            modify_database("", $sPermissionInsertQuery);
            echo $modifyoutput;
            flush();
            ob_flush();
        }
    }
}
开发者ID:himanshu12k,项目名称:ce-www,代码行数:63,代码来源:upgrade-all.php

示例7: XMLImportSurvey


//.........这里部分代码省略.........
        $tablename=$dbprefix.'assessments';

        foreach ($xml->assessments->rows->row as $row)
        {
            $insertdata=array();
            foreach ($row as $key=>$value)
            {
                $insertdata[(string)$key]=(string)$value;
            }
            if  ($insertdata['gid']>0)
            {
                $insertdata['gid']=$aGIDReplacements[(int)$insertdata['gid']]; // remap the qid
            }

            $insertdata['sid']=$newsid; // remap the survey id

            // now translate any links
            $query=$connect->GetInsertSQL($tablename,$insertdata);
            $result=$connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data<br />\$query<br />\n".$connect->ErrorMsg());
            $results['assessments']++;
        }
    }

    // Import quota --------------------------------------------------------------
    if(isset($xml->quota))
    {
        $tablename=$dbprefix.'quota';

        foreach ($xml->quota->rows->row as $row)
        {
            $insertdata=array();
            foreach ($row as $key=>$value)
            {
                $insertdata[(string)$key]=(string)$value;
            }
            $insertdata['sid']=$newsid; // remap the survey id
            $oldid=$insertdata['id'];
            unset($insertdata['id']);
            // now translate any links
            $query=$connect->GetInsertSQL($tablename,$insertdata);
            $result=$connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data<br />\$query<br />\n".$connect->ErrorMsg());
            $aQuotaReplacements[$oldid] = $connect->Insert_ID(db_table_name_nq('quota'),"id");
            $results['quota']++;
        }
    }

    // Import quota_members --------------------------------------------------------------
    if(isset($xml->quota_members))
    {
        $tablename=$dbprefix.'quota_members';

        foreach ($xml->quota_members->rows->row as $row)
        {
            $insertdata=array();
            foreach ($row as $key=>$value)
            {
                $insertdata[(string)$key]=(string)$value;
            }
            $insertdata['sid']=$newsid; // remap the survey id
            $insertdata['qid']=$aQIDReplacements[(int)$insertdata['qid']]; // remap the qid
            $insertdata['quota_id']=$aQuotaReplacements[(int)$insertdata['quota_id']]; // remap the qid
            unset($insertdata['id']);
            // now translate any links
            $query=$connect->GetInsertSQL($tablename,$insertdata);
            $result=$connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data<br />\$query<br />\n".$connect->ErrorMsg());
            $results['quotamembers']++;
        }
    }

    // Import quota_languagesettings --------------------------------------------------------------
    if(isset($xml->quota_languagesettings))
    {
        $tablename=$dbprefix.'quota_languagesettings';

        foreach ($xml->quota_languagesettings->rows->row as $row)
        {
            $insertdata=array();
            foreach ($row as $key=>$value)
            {
                $insertdata[(string)$key]=(string)$value;
            }
            $insertdata['quotals_quota_id']=$aQuotaReplacements[(int)$insertdata['quotals_quota_id']]; // remap the qid
            unset($insertdata['quotals_id']);
            // now translate any links
            $query=$connect->GetInsertSQL($tablename,$insertdata);
            $result=$connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data<br />\$query<br />\n".$connect->ErrorMsg());
            $results['quotals']++;
        }
    }

    // Set survey rights
    GiveAllSurveyPermissions($_SESSION['loginID'],$newsid);
    if ($bTranslateInsertansTags)
    {
        $aOldNewFieldmap=aReverseTranslateFieldnames($oldsid,$newsid,$aGIDReplacements,$aQIDReplacements);
        TranslateInsertansTags($newsid,$oldsid,$aOldNewFieldmap);
    }

    return $results;
}
开发者ID:nmklong,项目名称:limesurvey-cdio3,代码行数:101,代码来源:import_functions.php

示例8: addUserGroupInDB

function addUserGroupInDB($group_name, $group_description) {
    global $connect;
    $iquery = "INSERT INTO ".db_table_name('user_groups')." (name, description, owner_id) VALUES('{$group_name}', '{$group_description}', '{$_SESSION['loginID']}')";
    if($connect->Execute($iquery)) { //Checked
        $id = $connect->Insert_Id(db_table_name_nq('user_groups'),'ugid');
        if($id > 0) {
            $iquery = "INSERT INTO ".db_table_name('user_in_groups')." VALUES($id, '{$_SESSION['loginID']}')";
            $connect->Execute($iquery ) or safe_die($connect->ErrorMsg()); //Checked
        }
        return $id;
    } else {
        return -1;
    }
}
开发者ID:nmklong,项目名称:limesurvey-cdio3,代码行数:14,代码来源:userrighthandling.php

示例9: get_quotaCompletedCount

/**
 * get_quotaCompletedCount() returns the number of answers matching the quota
 * @param string $surveyid - Survey identification number
 * @param string $quotaid - quota id for which you want to compute the completed field
 * @return string - number of mathing entries in the result DB or 'N/A'
 */
function get_quotaCompletedCount($surveyid, $quotaid)
{
    $result = "N/A";
    $quota_info = getQuotaInformation($surveyid, GetBaseLanguageFromSurveyID($surveyid), $quotaid);
    $quota = $quota_info[0];
    if (db_tables_exist(db_table_name_nq('survey_' . $surveyid)) && count($quota['members']) > 0) {
        $fields_list = array();
        // Keep a list of fields for easy reference
        // construct an array of value for each $quota['members']['fieldnames']
        unset($querycond);
        $fields_query = array();
        foreach ($quota['members'] as $member) {
            foreach ($member['fieldnames'] as $fieldname) {
                if (!in_array($fieldname, $fields_list)) {
                    $fields_list[] = $fieldname;
                    $fields_query[$fieldname] = array();
                }
                $fields_query[$fieldname][] = db_quote_id($fieldname) . " = '{$member['value']}'";
            }
        }
        foreach ($fields_list as $fieldname) {
            $select_query = " ( " . implode(' OR ', $fields_query[$fieldname]) . ' )';
            $querycond[] = $select_query;
        }
        $querysel = "SELECT count(id) as count FROM " . db_table_name('survey_' . $surveyid) . " WHERE " . implode(' AND ', $querycond) . " " . " AND submitdate IS NOT NULL";
        $result = db_execute_assoc($querysel) or safe_die($connect->ErrorMsg());
        //Checked
        $quota_check = $result->FetchRow();
        $result = $quota_check['count'];
    }
    return $result;
}
开发者ID:karime7gezly,项目名称:OpenConextApps-LimeSurvey,代码行数:38,代码来源:common_functions.php

示例10: StartSurvey

 /**
  * Initialize a survey so can use EM to manage navigation
  * @param <type> $surveyid
  * @param <type> $surveyMode
  * @param <type> $anonymized
  * @param <type> $forceRefresh
  */
 static function StartSurvey($surveyid, $surveyMode = 'group', $options = NULL, $forceRefresh = false, $debugLevel = 0)
 {
     $LEM =& LimeExpressionManager::singleton();
     $LEM->sid = sanitize_int($surveyid);
     if (is_null($options)) {
         $options = array();
     }
     $LEM->surveyOptions['active'] = isset($options['active']) ? $options['active'] : false;
     $LEM->surveyOptions['allowsave'] = isset($options['allowsave']) ? $options['allowsave'] : false;
     $LEM->surveyOptions['anonymized'] = isset($options['anonymized']) ? $options['anonymized'] : false;
     $LEM->surveyOptions['assessments'] = isset($options['assessments']) ? $options['assessments'] : false;
     $LEM->surveyOptions['datestamp'] = isset($options['datestamp']) ? $options['datestamp'] : false;
     $LEM->surveyOptions['deletenonvalues'] = isset($options['deletenonvalues']) ? $options['deletenonvalues'] == '1' : true;
     $LEM->surveyOptions['hyperlinkSyntaxHighlighting'] = isset($options['hyperlinkSyntaxHighlighting']) ? $options['hyperlinkSyntaxHighlighting'] : false;
     $LEM->surveyOptions['ipaddr'] = isset($options['ipaddr']) ? $options['ipaddr'] : false;
     $LEM->surveyOptions['radix'] = isset($options['radix']) ? $options['radix'] : '.';
     $LEM->surveyOptions['refurl'] = isset($options['refurl']) ? $options['refurl'] : NULL;
     $LEM->surveyOptions['rooturl'] = isset($options['rooturl']) ? $options['rooturl'] : '';
     $LEM->surveyOptions['savetimings'] = isset($options['savetimings']) ? $options['savetimings'] : '';
     $LEM->sgqaNaming = isset($options['sgqaNaming']) ? $options['sgqaNaming'] == "Y" : true;
     // TODO default should eventually be false
     $LEM->surveyOptions['startlanguage'] = isset($options['startlanguage']) ? $options['startlanguage'] : 'en';
     $LEM->surveyOptions['surveyls_dateformat'] = isset($options['surveyls_dateformat']) ? $options['surveyls_dateformat'] : 1;
     $LEM->surveyOptions['tablename'] = isset($options['tablename']) ? $options['tablename'] : db_table_name_nq('survey_' . $LEM->sid);
     $LEM->surveyOptions['tablename_timings'] = isset($options['savetimings']) && $options['savetimings'] == 'Y' ? db_table_name('survey_' . $LEM->sid . '_timings') : '';
     $LEM->surveyOptions['target'] = isset($options['target']) ? $options['target'] : '/temp/files/';
     $LEM->surveyOptions['timeadjust'] = isset($options['timeadjust']) ? $options['timeadjust'] : 0;
     $LEM->surveyOptions['tempdir'] = isset($options['tempdir']) ? $options['tempdir'] : '/temp/';
     $LEM->surveyOptions['token'] = isset($options['token']) ? $options['token'] : NULL;
     $LEM->debugLevel = $debugLevel;
     $_SESSION['LEMdebugLevel'] = $debugLevel;
     // need acces to SESSSION to decide whether to cache serialized instance of $LEM
     switch ($surveyMode) {
         case 'survey':
             $LEM->allOnOnePage = true;
             $LEM->surveyMode = 'survey';
             break;
         case 'question':
             $LEM->allOnOnePage = false;
             $LEM->surveyMode = 'question';
             break;
         default:
         case 'group':
             $LEM->allOnOnePage = false;
             $LEM->surveyMode = 'group';
             break;
     }
     $LEM->setVariableAndTokenMappingsForExpressionManager($surveyid, $forceRefresh, $LEM->surveyOptions['anonymized'], $LEM->allOnOnePage);
     $LEM->currentGroupSeq = -1;
     $LEM->currentQuestionSeq = -1;
     // for question-by-question mode
     $LEM->indexGseq = array();
     $LEM->indexQseq = array();
     $LEM->qrootVarName2arrayFilter = array();
     if (isset($_SESSION['startingValues']) && is_array($_SESSION['startingValues']) && count($_SESSION['startingValues']) > 0) {
         $startingValues = array();
         foreach ($_SESSION['startingValues'] as $k => $value) {
             if (isset($LEM->knownVars[$k])) {
                 $knownVar = $LEM->knownVars[$k];
             } else {
                 if (isset($LEM->qcode2sgqa[$k])) {
                     $knownVar = $LEM->knownVars[$LEM->qcode2sgqa[$k]];
                 } else {
                     if (isset($LEM->tempVars[$k])) {
                         $knownVar = $LEM->tempVar[$k];
                     } else {
                         continue;
                     }
                 }
             }
             if (!isset($knownVar['jsName'])) {
                 continue;
             }
             switch ($knownVar['type']) {
                 case 'D':
                     //DATE
                     if (trim($value) == "") {
                         $value = NULL;
                     } else {
                         $dateformatdatat = getDateFormatData($LEM->surveyOptions['surveyls_dateformat']);
                         $datetimeobj = new Date_Time_Converter($value, $dateformatdatat['phpdate']);
                         $value = $datetimeobj->convert("Y-m-d");
                     }
                     break;
                 case 'N':
                     //NUMERICAL QUESTION TYPE
                 //NUMERICAL QUESTION TYPE
                 case 'K':
                     //MULTIPLE NUMERICAL QUESTION
                     if (trim($value) == "") {
                         $value = NULL;
                     } else {
                         $value = sanitize_float($value);
//.........这里部分代码省略.........
开发者ID:ddrmoscow,项目名称:queXS,代码行数:101,代码来源:LimeExpressionManager.php

示例11: markDeleted

function markDeleted($item) {
	global $connect;
	$query = "update ".db_table_name_nq("cdio3_learningoutcomes")." set status='".db_quote('0')."' ";
	$query .="where id in (".db_quote($item).")";
	
	$connect->execute($query);
	
	return true;
}
开发者ID:nmklong,项目名称:limesurvey-cdio3,代码行数:9,代码来源:cdio3_common_functions.php

示例12: StartSurvey

 /**
  * Initialize a survey so can use EM to manage navigation
  * @param <type> $surveyid
  * @param <type> $surveyMode
  * @param <type> $anonymized
  * @param <type> $forceRefresh
  */
 static function StartSurvey($surveyid, $surveyMode = 'group', $options = NULL, $forceRefresh = false, $debugLevel = 0)
 {
     $LEM =& LimeExpressionManager::singleton();
     $LEM->sid = sanitize_int($surveyid);
     if (is_null($options)) {
         $options = array();
     }
     $LEM->surveyOptions['active'] = isset($options['active']) ? $options['active'] : false;
     $LEM->surveyOptions['allowsave'] = isset($options['allowsave']) ? $options['allowsave'] : false;
     $LEM->surveyOptions['anonymized'] = isset($options['anonymized']) ? $options['anonymized'] : false;
     $LEM->surveyOptions['assessments'] = isset($options['assessments']) ? $options['assessments'] : false;
     $LEM->surveyOptions['datestamp'] = isset($options['datestamp']) ? $options['datestamp'] : false;
     $LEM->surveyOptions['hyperlinkSyntaxHighlighting'] = isset($options['hyperlinkSyntaxHighlighting']) ? $options['hyperlinkSyntaxHighlighting'] : false;
     $LEM->surveyOptions['ipaddr'] = isset($options['ipaddr']) ? $options['ipaddr'] : false;
     $LEM->surveyOptions['radix'] = isset($options['radix']) ? $options['radix'] : '.';
     $LEM->surveyOptions['refurl'] = isset($options['refurl']) ? $options['refurl'] : NULL;
     $LEM->surveyOptions['rooturl'] = isset($options['rooturl']) ? $options['rooturl'] : '';
     $LEM->surveyOptions['savetimings'] = isset($options['savetimings']) ? $options['savetimings'] : '';
     $LEM->sgqaNaming = isset($options['sgqaNaming']) ? $options['sgqaNaming'] == "Y" : true;
     // TODO default should eventually be false
     $LEM->surveyOptions['startlanguage'] = isset($options['startlanguage']) ? $options['startlanguage'] : 'en';
     $LEM->surveyOptions['surveyls_dateformat'] = isset($options['surveyls_dateformat']) ? $options['surveyls_dateformat'] : 1;
     $LEM->surveyOptions['tablename'] = isset($options['tablename']) ? $options['tablename'] : db_table_name_nq('survey_' . $LEM->sid);
     $LEM->surveyOptions['tablename_timings'] = isset($options['savetimings']) && $options['savetimings'] == 'Y' ? db_table_name('survey_' . $LEM->sid . '_timings') : '';
     $LEM->surveyOptions['target'] = isset($options['target']) ? $options['target'] : '/temp/files/';
     $LEM->surveyOptions['timeadjust'] = isset($options['timeadjust']) ? $options['timeadjust'] : 0;
     $LEM->surveyOptions['tempdir'] = isset($options['tempdir']) ? $options['tempdir'] : '/temp/';
     $LEM->surveyOptions['token'] = isset($options['token']) ? $options['token'] : NULL;
     $LEM->debugLevel = $debugLevel;
     $_SESSION['LEMdebugLevel'] = $debugLevel;
     // need acces to SESSSION to decide whether to cache serialized instance of $LEM
     switch ($surveyMode) {
         case 'survey':
             $LEM->allOnOnePage = true;
             $LEM->surveyMode = 'survey';
             break;
         case 'question':
             $LEM->allOnOnePage = false;
             $LEM->surveyMode = 'question';
             break;
         default:
         case 'group':
             $LEM->allOnOnePage = false;
             $LEM->surveyMode = 'group';
             break;
     }
     $LEM->setVariableAndTokenMappingsForExpressionManager($surveyid, $forceRefresh, $LEM->surveyOptions['anonymized'], $LEM->allOnOnePage);
     $LEM->currentGroupSeq = -1;
     $LEM->currentQuestionSeq = -1;
     // for question-by-question mode
     $LEM->indexGseq = array();
     $LEM->indexQseq = array();
     if (isset($_SESSION['startingValues']) && is_array($_SESSION['startingValues']) && count($_SESSION['startingValues']) > 0) {
         $startingValues = $_SESSION['startingValues'];
         $LEM->_UpdateValuesInDatabase($startingValues);
     }
     return array('hasNext' => true, 'hasPrevious' => false);
 }
开发者ID:rkaldung,项目名称:LimeSurvey,代码行数:65,代码来源:LimeExpressionManager.php

示例13: insertlabelset

function insertlabelset()
{
    global $dbprefix, $connect, $clang, $labelsoutput;
    //	$labelsoutput.= $_POST['languageids'];  For debug purposes

    if (isset($_POST['languageids']))
    {
        $postlanguageids=sanitize_languagecodeS($_POST['languageids']);
    }

    if (isset($_POST['label_name']))
    {
        $postlabel_name=sanitize_labelname($_POST['label_name']);
    }

    $postlabel_name = db_quoteall($postlabel_name,true);
    $postlanguageids = db_quoteall($postlanguageids,true);

    $query = "INSERT INTO ".db_table_name('labelsets')." (label_name,languages) VALUES ({$postlabel_name},{$postlanguageids})";
    if (!$result = $connect->Execute($query))
    {
        safe_die("Inserting the label set failed:<br />".$query."<br />".$connect->ErrorMsg());
    }
    else
    {
        return $connect->Insert_ID(db_table_name_nq('labelsets'),"lid");
    }

}
开发者ID:nmklong,项目名称:limesurvey-cdio3,代码行数:29,代码来源:labels.php

示例14: get2post

    $deactivateoutput .= "\t<input type='submit' value='" . $clang->gT("Deactivate Survey") . "' onclick=\"" . get2post("{$scriptname}?action=deactivate&amp;ok=Y&amp;sid={$_GET['sid']}") . "\" />\n";
    $deactivateoutput .= "</div><br />\n";
} else {
    //See if there is a tokens table for this survey
    if (tableExists("tokens_{$postsid}")) {
        $toldtable = "tokens_{$postsid}";
        $tnewtable = "old_tokens_{$postsid}_{$date}";
        $tdeactivatequery = db_rename_table(db_table_name_nq($toldtable), db_table_name_nq($tnewtable));
        $tdeactivateresult = $connect->Execute($tdeactivatequery) or die("Couldn't deactivate tokens table because:<br />" . htmlspecialchars($connect->ErrorMsg()) . "<br /><br />Survey was not deactivated either.<br /><br /><a href='{$scriptname}?sid={$postsid}'>" . $clang->gT("Main Admin Screen") . "</a>");
        if ($databasetype == 'postgres') {
            // If you deactivate a postgres table you have to rename the according sequence too and alter the id field to point to the changed sequence
            $deactivatequery = db_rename_table(db_table_name_nq($toldtable) . '_tid_seq', db_table_name_nq($tnewtable) . '_tid_seq');
            $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) {
开发者ID:himanshu12k,项目名称:ce-www,代码行数:31,代码来源:deactivate.php


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