Exemple #1
0
function getproblemsearch()
{
    $search = I('get.search', '');
    if ($search != '') {
        $sql = "(`creator` like '%{$search}%' or `point` like '%{$search}%')";
    } else {
        $sql = "";
    }
    $problem = I('get.problem', 0, 'intval');
    $prosql = problemshow($problem, $sql);
    $sql .= $prosql;
    return array('search' => $search, 'problem' => $problem, 'sql' => $sql);
}
Exemple #2
0
function getproblemsearch($idKey, $problemType)
{
    $sql = "";
    $chapterId = I('get.chapterId', 0, 'intval');
    $parentId = I('get.parentId', 0, 'intval');
    $pointId = I('get.pointId', 0, 'intval');
    if ($pointId > 0) {
        $sql = "{$idKey} in (select question_id from ex_question_point where type = {$problemType} and point_id = {$pointId})";
    } else {
        if ($parentId > 0) {
            $sql = "{$idKey} in (select question_id from ex_question_point where type = {$problemType} and point_parent_id = {$parentId})";
        } else {
            if ($chapterId > 0) {
                $sql = "{$idKey} in (select question_id from ex_question_point where type = {$problemType} and chapter_id = {$chapterId})";
            }
        }
    }
    $problem = I('get.problem', 0, 'intval');
    $prosql = problemshow($problem, $sql);
    $sql .= $prosql;
    return array('sql' => $sql);
}