Solution Technologies
Управление сайтом без ограничений
{**
 * XS2:
 *
 * This file is developed by Solutecs, LLC for the purpose of the company
 * and is provided together with XS2 Framework as and inherent part of the
 * system. This file can be used on the terms of License Agreement.
 *
 * +7 (495) 585-0833 / 13 Rusakovskaya street, Moscow 107140 Russia
 *
 * @link http://www.solutecs.com
 * @copyright ©1998-2007 Solutecs, LLC
 * @version 1.XX
 *}



<SCRIPT language="Javascript">
{literal}

  function s_question(a,l){
    if (l==0) return;
    var f=a.form;
    var j = 0;
    for(var i=0; i<f.elements.length; i++){
      el = f.elements[i];
      if((el.getAttribute('q') == a.getAttribute('q')) && (el.checked) && (el.id!=a.id)){
        j++;
        t = el;
      }
    }

    if (j+1 > l){
      if (l==1){
         t.checked = false;
      }
      else a.checked = false;
    }
  }

  function slice(a,q){
    var f=a.form;
    for(var i=0; i<f.elements.length; i++){
      el = f.elements[i];
      if(el.getAttribute('sq') == q){
        el.disabled = !a.checked;
      }
    }
  }

{/literal}
</SCRIPT>

{* Вывод вопросов, которые могут служить фильтрами *}

{if $_THE.PARAMS[0]}
  {xs2GetNode NodId=$_THE.PARAMS[0] var="poll"}
{else}
  {xs2GetNodes NType="poll" var="polls"}
  {assign var="poll" value=$polls[0]}
{/if}
{xs2GetChildren ParId=$poll.NodId var="questions" NType="s_question" condition="Slice=1"}

<H1>{$poll.NName} - сформировать отчет по результатам</H1>

<P>Включить следующие срезы:

<FORM action="{xs2Href mod="polls" obj="poll" met="results" atr=$poll.NodId}" method="POST">
  {assign var="qCount" value=1}
  {foreach name="pl" from=$questions item="question"}
    {if $question.NType!="results"}
      {xs2GetChildren ParId=$question.NodId var="answers" NType="answer_var,answer_ext"}
      {xs2GetChildren ParId=$question.NodId var="subquestions" NType="subquestion"}

      <DIV>
        <INPUT type="checkbox" name="slice{$question.NodId}"
               onclick="slice(this,{$question.NodId})">
          <STRONG>{$qCount}. {$question.NName}</STRONG>
      </DIV>
      <DIV>
        {if $subquestions}
          {* Если вопрос состоит из нескольких подвопросов *}
          <TABLE border="1">
            <TR>
              <TH></TH>
              {foreach from=$answers item="answer"}
                <TH>{$answer.NName}</TH>
              {/foreach}
            </TR>
            {foreach from=$subquestions item="subquestion"}
              <TR>
                <TD>{$subquestion.NName}</TD>
                {foreach name="al" from=$answers item="answer"}
                <TD>
                  <DIV>
                    <INPUT type="checkbox"
                           disabled="true"
                           name="q[{$question.NodId}][{$subquestion.NodId}][{$answer.NodId}]"
                           t="{$answer.NType}"
                           q="{$subquestion.NodId}"
                           sq="{$question.NodId}"
                           id="{$subquestion.NodId}_{$answer.NodId}"
                           value="1"
                           onClick="s_question(this,{$question.AnswersLimit})">
                  </DIV>
                </TD>
                {/foreach}
              </TR>
            {/foreach}
          </TABLE>
        {else}
          {* Если подвопросов нет *}
          {foreach name="al" from=$answers item="answer"}
            <DIV>
              <INPUT type="checkbox"
                     disabled="true"
                     name="q[{$question.NodId}][0][{$answer.NodId}]"
                     t="{$answer.NType}"
                     q="{$question.NodId}"
                     sq="{$question.NodId}"
                     id="{$answer.NodId}"
                     value="1"
                     onClick="s_question(this,{$question.AnswersLimit})">
              {$answer.NName}
            </DIV>
          {/foreach}
        {/if}
      </DIV>

      {assign var="qCount" value=$qCount+1}
    {/if}
  {/foreach}
  <INPUT type="submit" value="Сформировать отчет">
</FORM>

{* /Вывод вопросов, которые могут служить фильтрами *}
Copyright ©1998-2008 Солютекс. Все права защищены.
Этот сайт сделан в designLab | Работает на технологии XS2
Условия использования | О защите конфиденциальности