From: Chris S. <san...@us...> - 2010-08-26 13:19:33
|
Update of /cvsroot/stack/stack-dev/lib/ui In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv1437/lib/ui Modified Files: Tag: STACK2_2 questionBank.php Log Message: Index: questionBank.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/ui/questionBank.php,v retrieving revision 1.6.10.4 retrieving revision 1.6.10.5 diff -C2 -d -r1.6.10.4 -r1.6.10.5 *** questionBank.php 6 Aug 2010 14:45:56 -0000 1.6.10.4 --- questionBank.php 26 Aug 2010 13:19:25 -0000 1.6.10.5 *************** *** 33,36 **** --- 33,37 ---- $question_bank_filter['description'] = ''; $question_bank_filter['keywords'] = array(); + $question_bank_filter['invertKeywords']= FALSE; $question_bank_filter['case_sense'] = FALSE; $question_bank_filter['any'] = 'Any'; *************** *** 154,158 **** // sort tags (lowercase keywords) asort($tags); ! echo "<th>".get_string('stackQuestion_questionKeywordFilter', 'stack').":</th> <td colspan='3'><a href='index.php?untagged=*'>".get_string('stackQuestion_questionKeywordReset', 'stack')."</a>, "; $firstTag = true; --- 155,159 ---- // sort tags (lowercase keywords) asort($tags); ! echo "<th>".get_string('stackQuestion_questionKeywordFilter', 'stack').":</th> <td colspan='3'><a href='index.php?untagged=*'>".get_string('stackQuestion_questionKeywordReset', 'stack')."</a>, "; $firstTag = true; *************** *** 165,170 **** } echo "</td>"; } - echo '</tr>'; } --- 166,177 ---- } echo "</td>"; + echo '</tr>'; + + if ($filter['invertKeywords']) { + echo "<th>".get_string('stackQuestion_questionKeywordInvertFilter', 'stack').":</th> <td><input type='checkbox' name='bank_filter[invertKeywords]' value='TRUE' checked='TRUE'/></th></tr>"; + } else { + echo "<th>".get_string('stackQuestion_questionKeywordInvertFilter', 'stack').":</th> <td><input type='checkbox' name='bank_filter[invertKeywords]' value='TRUE' /></th></tr>"; + } } } *************** *** 183,186 **** --- 190,194 ---- $filter_des = $filter['description']; $filter_kw = $filter['keywords']; + $filter_kw_I = $filter['invertKeywords']; $q_name = $question['questionName']; $q_des = $question['questionDescription']; *************** *** 253,273 **** $filter_needed = TRUE; ! if ('Any' == $filter['any']) { ! // Any of the keywords ! foreach ($q_kw as $kw) { ! if (array_key_exists($kw,$filter_kw)) { ! $dispQ = TRUE; } ! } ! } else { ! // All the keywords ! $dispQ = TRUE; ! foreach ($filter_kw as $kw=>$val) { ! if (false===in_array($kw,$q_kw)) { ! $dispQ = FALSE; } } - } } --- 261,291 ---- $filter_needed = TRUE; ! if ('Any' == $filter['any']) { ! $dispQK = FALSE; ! // Any of the keywords ! foreach ($q_kw as $kw) { ! if (array_key_exists($kw,$filter_kw)) { ! $dispQK = TRUE; ! } } ! } else { ! // All the keywords ! $dispQK = TRUE; ! foreach ($filter_kw as $kw=>$val) { ! if (false===in_array($kw,$q_kw)) { ! $dispQK = FALSE; ! } } } + // Inverts based soley on whether we "invert keywords" + if ($filter_kw_I) { + $dispQK = !$dispQK; + } + if ('Any' == $filter['any']) { + if ($dispQ OR $dispQK) {$dispQ=TRUE;} else {$dispQ=FALSE;} + } else { + if ($dispQ AND $dispQK) {$dispQ=TRUE;} else {$dispQ=FALSE;} + } } |