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


PHP getQuestions函数代码示例

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


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

示例1: getQuestion

function getQuestion($id)
{
    $qsts = getQuestions();
    foreach ($qsts as $q) {
        if ($q["id"] == $id) {
            return $q;
        }
    }
    return null;
}
开发者ID:ConcertUrbain,项目名称:handicap,代码行数:10,代码来源:api_handicap.php

示例2: getQuestions

function getQuestions($pollid, $parentid = 0, $depth = 0)
{
    global $db;
    $parents = $db->selectList('detailedpoll_questions', '*', "`parentid`=" . $parentid . " AND `detailedpollid` = " . (int) $pollid, "`rank` ASC");
    if ($parents) {
        $newparents = array();
        foreach ($parents as $parent) {
            $childs = getQuestions($pollid, $parent['questionid'], $depth + 1);
            $parent['depth'] = $depth;
            $parent['childs'] = $childs ? count($childs) : 0;
            $newparents[] = $parent;
            if ($childs) {
                $newparents = array_merge($newparents, $childs);
            }
        }
        return $newparents;
    } else {
        return false;
    }
}
开发者ID:tech-nik89,项目名称:lpm4,代码行数:20,代码来源:detailedpoll.function.php

示例3: doAction

function doAction($action)
{
    $forwardpage = "";
    $forward = true;
    $loggedin = isUserLoggedIn();
    if (!$loggedin && strcmp($action, "login") != 0 && strcmp($action, "register") != 0 && strcmp($action, "getTags") != 0) {
        addError("fatal", "user.unathorized");
        outputJSON("error");
    } else {
        if (strcmp($action, "login") == 0) {
            login();
        } else {
            if (strcmp($action, "logout") == 0) {
                logout();
            } else {
                if (strcmp($action, "isLoggedIn") == 0) {
                    isLoggedIn();
                } else {
                    if (strcmp($action, "register") == 0) {
                        register();
                    } else {
                        if (strcmp($action, "addquestion") == 0) {
                            addQuestion();
                        } else {
                            if (strcmp($action, "getTags") == 0) {
                                getTags();
                            } else {
                                if (strcmp($action, "getquestions") == 0) {
                                    getQuestions();
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
开发者ID:nithin001,项目名称:catcracker,代码行数:38,代码来源:controller.php

示例4: getQuestions

include "includes.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<title>Conseil general - Titre du site</title>
<?php 
include "head.php";
?>
<link rel="stylesheet" type="text/css" href="styles/mosaic.css?v=1"></link>
<script src="js/mosaic.js?v=1" type="text/javascript"></script>
</head>
<body><div class="all" id="all-global"><?php 
//ORDRE DES ELEMENTS EST IMPORTANT
if (strlen($cat) < 1) {
    $qsts = getQuestions();
    if (count($qsts) < 1) {
        die("Pas de questions");
    }
    $question = getCurrentQuestion();
    $qstId = $question["id"];
    include "mosaicContent.php";
} else {
    if (strpos($cat, "presentation") > -1) {
        list($cat, $subcat) = explode("-", $cat);
        include "presentation.php";
    } else {
        include $cat . ".php";
    }
}
?>
开发者ID:ConcertUrbain,项目名称:handicap,代码行数:31,代码来源:mosaic.php

示例5: json_decode

<?php

require_once "feeder.php";
$requests = json_decode(file_get_contents("php://input"));
$gQ = getQuestions();
$output = array();
$i = 0;
foreach ($gQ as $q) {
    $output[$i] = array("id" => $q['id'], "question" => $q['question'], "choices" => $q['choices']);
    $i++;
}
echo '{"result":' . json_encode($output) . '}';
开发者ID:firdausibnu,项目名称:webdes,代码行数:12,代码来源:questions.php

示例6: mysql_query

            $results = mysql_query($query, $db_conn);
            if (!$results) {
                die("Error: " . mysql_error($db_conn));
            }
            while ($r = mysql_fetch_assoc($results)) {
                $rows[] = array('text' => $r["text"], 'votes' => $r["numvotes"], 'answered' => $r["answered"], 'type' => 'Q');
            }
        } elseif ($type == 'F') {
            // Query Feedback and fetch results
            $query = sprintf("SELECT * FROM Feedback WHERE sid = %d", $sid);
            $results = mysql_query($query, $db_conn);
            if (!$results) {
                die("Error: " . mysql_error($db_conn));
            }
            while ($r = mysql_fetch_assoc($results)) {
                $rows[] = array('text' => $r["text"], 'votes' => $r["numvotes"], 'isread' => $r["isread"], 'type' => 'F');
            }
        }
        mysql_close($db_conn);
        return $rows;
    }
}
if (isset($_POST['sid']) && isset($_POST['type'])) {
    $sid = $_POST['sid'];
    $type = $_POST['type'];
    $results = getQuestions($sid, $type);
    // Return the questions and feedback back to the calling Javascript
    // as a JSON object
    header('Content-type: application/json');
    echo json_encode($results);
}
开发者ID:kumarsivarajan,项目名称:classroom-presenter,代码行数:31,代码来源:studenthome_lookup_questions.php

示例7: die

<?php

$apiKey = $_GET['apiKey'];
$formID = $_GET['formID'];
$format = $_GET['format'];
$columnHeaders = $_GET['columnHeaders'];
if ($formID < 1) {
    die("Form ID Missing!");
}
include 'form_details.php';
$formTitle = getFormTitle($apiKey, $formID);
$questions = getQuestions($apiKey, $formID, $columnHeaders);
$submissions = getSubmissions($apiKey, $formID);
switch ($format) {
    case 'PostgreSQL':
        include 'jotform_postgresqldump.php';
        $sql = jotform_postgresqldump($apiKey, $format, $formTitle, $questions, $submissions);
        break;
    case 'Oracle':
        include 'jotform_oracledump.php';
        $sql = jotform_oracledump($apiKey, $format, $formTitle, $questions, $submissions);
        break;
    case 'SQL Server':
        include 'jotform_sqlserverdump.php';
        $sql = jotform_sqlserverdump($apiKey, $format, $formTitle, $questions, $submissions);
        break;
    case 'DB2':
        include 'jotform_db2dump.php';
        $sql = jotform_db2dump($apiKey, $format, $formTitle, $questions, $submissions);
        break;
    case 'Sybase':
开发者ID:abmedia,项目名称:api-use-cases,代码行数:31,代码来源:get_mysqldump.php

示例8: postQuestion

require_once "./includes/mysql.php";
include "./includes/header.php";
?>

<?php 
if (isset($_POST['type'])) {
    if ($_POST['type'] == 'ask') {
        postQuestion($_POST);
    }
}
$q = '';
if (isset($_GET['q']) && !is_null($_GET['q'])) {
    $q = $_GET['q'];
    $questions = getQuestions($_GET['q']);
} else {
    $questions = getQuestions();
}
?>

<div id="main-page" onload="function() {document.getElementById('autofocus').focus();}">
	<div id="main-search" class="center">
		<form action="index.php" method="GET">
			<input autofocus="autofocus" type="text" name="q" id="search-bar" placeholder="Search question topic or content here..." value="<?php 
echo $q;
?>
">
			<input type="submit" value="Search">
		</form>
		<p>Cannot find what you are looking for? <a href="ask.php">Ask here</a></p>
	</div>
开发者ID:natanelia,项目名称:IF3110-2015-T1,代码行数:30,代码来源:index.php

示例9: getQuestions

            } else {
                echo "<tr>";
            }
            if ($feed[$row]["voted"] == 1) {
                echo "<td class=checked><input class=check type=checkbox id=check_" . $feed[$row]["type"] . $feed[$row]["id"] . " checked=true /></td>";
            } else {
                echo "<td class=checked><input class=check type=checkbox id=check_" . $feed[$row]["type"] . $feed[$row]["id"] . " /></td>";
            }
            echo "<td class=feed>" . $feed[$row]["text"] . "</td>";
            if ($feed[$row]["type"] == 'Q' && $feed[$row]["answered"] == 1 || $feed[$row]["type"] == 'F' && $feed[$row]["isread"] == 1) {
                echo "<td class=answered>Yes</td>";
            } else {
                echo "<td class=answered>No</td>";
            }
            //echo "<td class=answered>".$feed[$row]["answered"]."</td>";
            echo "</tr>";
        }
    }
    echo "</table>";
}
if (isset($_POST['sid']) && isset($_POST['filter']) && isset($_POST['sort']) && isset($_POST['uid'])) {
    $sid = $_POST['sid'];
    $filter = $_POST['filter'];
    $sort = $_POST['sort'];
    $uid = $_POST['uid'];
    $feed = getQuestions($sid, $filter, $sort, $uid);
    echoTable($feed);
}
?>
	
开发者ID:kumarsivarajan,项目名称:classroom-presenter,代码行数:29,代码来源:studentfeed_lookup_questions.php

示例10: session_start

    session_start();
    $_SESSION['player_type'] = getGenderFromType(filter_var($_POST['player_type']));
    $_SESSION['play'] = true;
    $_SESSION['name'] = getWho($_POST['player_type']);
    $_SESSION['result'] = 0;
    echo json_encode(true);
} else {
    session_start();
    if (!isset($_SESSION['play'])) {
        header("location: " . URL . HOME);
        exit;
    }
}
if (isset($_SESSION['play'])) {
    $ques_type = $_SESSION['player_type'];
    $questions = getQuestions($ques_type);
    $options = getAnswerOpt($questions);
    $name = $_SESSION['name'];
}
function getGenderFromType($type)
{
    $female = "Female";
    $male = "Male";
    $self = "Self";
    $me = "Me";
    $mother = "Wife";
    $sister = "Sister";
    $father = "Husband";
    $brother = "Brother";
    $friendMale = "Friend-male";
    $friendFemale = "Friend-female";
开发者ID:uchechukwudim,项目名称:testandtreatmalaria,代码行数:31,代码来源:process_questions.php

示例11: echoTable

}
function echoTable($rows)
{
    // Prints out the feed data in a nice html format
    echo "<table id=feedTable>";
    for ($row = 0; $row < 200; $row++) {
        if (!empty($rows[$row])) {
            if ($rows[$row]["type"] == "Q") {
                echo "<tr class=alt>";
            } else {
                echo "<tr>";
            }
            echo "<td class=votes>" . $rows[$row]["votes"] . "</td>";
            echo "<td class=feed>" . $rows[$row]["text"] . "</td>";
            if ($rows[$row]["answered"] == 1 || $rows[$row]["isread"] == 1) {
                echo "<td class=checked><input class=check type=checkbox id=check_" . $rows[$row]["type"] . $rows[$row]["id"] . " checked=true /></td>";
            } else {
                echo "<td class=checked><input class=check type=checkbox id=check_" . $rows[$row]["type"] . $rows[$row]["id"] . "/></td>";
            }
            echo "</tr>";
        }
    }
    echo "</table>";
}
if (isset($_POST['sid']) && isset($_POST['filter']) && isset($_POST['sort'])) {
    $sid = $_POST['sid'];
    $filter = $_POST['filter'];
    $sort = $_POST['sort'];
    $rows = getQuestions($sid, $filter, $sort);
    echoTable($rows);
}
开发者ID:kumarsivarajan,项目名称:classroom-presenter,代码行数:31,代码来源:lookup_questions.php

示例12: loadContestData

function loadContestData($db)
{
    global $tinyOrm, $config;
    $teamID = $_SESSION["teamID"];
    $stmt = $db->prepare("UPDATE `team` SET `startTime` = NOW() WHERE `ID` = :teamID AND `startTime` IS NULL");
    $stmt->execute(array("teamID" => $teamID));
    if ($config->db->use == 'dynamoDB') {
        $stmt = $db->prepare("SELECT `startTime` FROM `team` WHERE `ID` = :teamID");
        $stmt->execute(array("teamID" => $teamID));
        $row = $stmt->fetchObject();
        try {
            $tinyOrm->update('team', array('startTime' => $row->startTime), array('ID' => $teamID, 'startTime' => null));
        } catch (\Aws\DynamoDb\Exception $e) {
            error_log($e->getMessage . " - " . $e->getCode());
            error_log('DynamoDB error updating team for teamID: ' . $teamID);
        }
    }
    $questionsData = getQuestions($db, $_SESSION["contestID"]);
    //$stmt = $db->prepare("SELECT `questionID`, `answer` FROM `team_question` WHERE `teamID` = ?");
    //$stmt->execute(array($teamID));
    try {
        $results = $tinyOrm->select('team_question', array('questionID', 'answer', 'ffScore'), array('teamID' => $teamID));
    } catch (\Aws\DynamoDb\Exception $e) {
        error_log($e->getMessage . " - " . $e->getCode());
        error_log('DynamoDB error retrieving team_questions for teamID: ' . $teamID);
    }
    $answers = array();
    $scores = array();
    //while ($row = $stmt->fetchObject()) {
    foreach ($results as $row) {
        if (isset($row['answer'])) {
            $answers[$row['questionID']] = $row['answer'];
        }
        if (isset($row['ffScore'])) {
            $scores[$row['questionID']] = $row['ffScore'];
        }
    }
    $stmt = $db->prepare("SELECT TIME_TO_SEC(TIMEDIFF(NOW(), `team`.`startTime`)) as `timeUsed`, `endTime` FROM `team` WHERE `ID` = ?");
    $stmt->execute(array($teamID));
    $row = $stmt->fetchObject();
    $_SESSION["startTime"] = time() - intval($row->timeUsed);
    if ($row->endTime != null) {
        $_SESSION["closed"] = true;
    }
    echo json_encode((object) array("success" => true, "questionsData" => $questionsData, 'scores' => $scores, "answers" => $answers, "timeUsed" => $row->timeUsed, "endTime" => $row->endTime, "teamPassword" => $_SESSION["teamPassword"]));
}
开发者ID:BebrasTeam,项目名称:BebrasContestServer,代码行数:46,代码来源:data.php

示例13: testGetReadFeedback

 public function testGetReadFeedback()
 {
     $db_conn = $this->initAndClearTables();
     $this->insertSubmission($db_conn, 'F', 'test1', 2, 1, 12345);
     sleep(1);
     $this->insertSubmission($db_conn, 'Q', 'test2', 1, 1, 12345);
     sleep(1);
     $this->insertSubmission($db_conn, 'F', 'test3', 0, 1, 12345);
     sleep(1);
     $this->insertSubmission($db_conn, 'Q', 'test4', 3, 1, 23456);
     sleep(1);
     $this->insertSubmission($db_conn, 'F', 'test5', 1, 1, 12345);
     sleep(1);
     $this->insertSubmission($db_conn, 'F', 'test6', 4, 0, 23456);
     include_once '../../Incognito/instr/scripts/lookup_questions.php';
     $feed = getQuestions(12345, "Read", "None");
     $this->assertEquals(3, count($feed));
     $this->assertEquals('test1', $feed[0]['text']);
     $this->assertEquals('test3', $feed[1]['text']);
     $this->assertEquals('test5', $feed[2]['text']);
     $feed = getQuestions(12345, "Read", "Newest");
     $this->assertEquals(3, count($feed));
     $this->assertEquals('test5', $feed[0]['text']);
     $this->assertEquals('test3', $feed[1]['text']);
     $this->assertEquals('test1', $feed[2]['text']);
     $feed = getQuestions(12345, "Read", "Priority");
     $this->assertEquals(3, count($feed));
     $this->assertEquals('test1', $feed[0]['text']);
     $this->assertEquals('test5', $feed[1]['text']);
     $this->assertEquals('test3', $feed[2]['text']);
 }
开发者ID:sivarajankumar,项目名称:classroom-presenter,代码行数:31,代码来源:test-instructorfeed.php

示例14: getMyAnswers

                    } else {
                        $notify->add($lang->get('detailedpoll'), $lang->get('notify_send_unsuccessfull'));
                    }
                } else {
                    $notify->add($lang->get('detailedpoll'), $lang->get('notify_send_unsuccessfull_fields_missing'));
                    $smarty->assign('values', $_POST['values']);
                }
            }
            if (hasVoted($pollid, $login->currentUserId())) {
                $smarty->assign('values', getMyAnswers($pollid, $login->currentUserId()));
            }
            $smarty->assign('sendAvailable', $poll['state'] == 1);
            $smarty->assign('resultAvailable', $poll['state'] >= 2);
            $smarty->assign('poll', $poll);
            if ($poll['state'] >= 2) {
                $questions = calculatePoll($pollid);
                $smarty->assign('result', getCalculatedPoll($questions));
            } else {
                $questions = getQuestions($pollid);
            }
            $smarty->assign('questions', $questions);
            $colors = array(0 => '#aaa', 1 => '#bbb', 2 => '#ccc', 3 => '#ddd');
            $smarty->assign('color', $colors);
            $smarty->assign('path', $template_dir . '/poll.tpl');
        } else {
            $allpolls = getPolls();
            $smarty->assign('polls', $allpolls);
            $smarty->assign('path', $template_dir . '/polls.tpl');
        }
        break;
}
开发者ID:tech-nik89,项目名称:lpm4,代码行数:31,代码来源:detailedpoll.mod.php

示例15: getQuestions

     $questions = 0;
     $questions = getQuestions($t_id);
     if (count($questions) == 0) {
         echo '<div class="h8 centered">' . Global_07 . "</div>";
     } else {
         $topics->setTopicID($t_id);
         $topics->setTopic($t_id);
         $Topic = $topics->getTopicName();
         echo "<br /><h2> " . Statistic_01 . " " . stripslashes($Topic) . "<br /></h2>";
         getTopTenCorrect($questions);
     }
     break;
 case 'flopTen':
     // die 10 schlechtest beantworteten Fragen
     $questions = 0;
     $questions = getQuestions($t_id);
     if (count($questions) == 0) {
         echo '<div class="h8 centered">' . Global_07 . "</div>";
     } else {
         $topics->setTopicID($t_id);
         $topics->setTopic($t_id);
         $Topic = $topics->getTopicName();
         echo "<br /><h2> " . Statistic_02 . " " . stripslashes($Topic) . "<br /></h2>";
         getFlopTenCorrects($questions);
     }
     break;
 case 'sortByTopic':
     // Fragen nach Thema sortieren
     $topics->getTopic();
     $topicarray = $topics->getTopicArray();
     $number = $qu->getNumberOfQuestions($topicarray);
开发者ID:eruedin,项目名称:cats,代码行数:31,代码来源:statistic.php


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