Blame view

protected/views/question/index.php 2.63 KB
a1684257   Administrator   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
  <?php
  /**
   * @var $this QuestionController
   * @var $questions Question[]
   * @var $questionCategories QuestionCategory[]
   * @var $contacts Contact[]
   * @var $currentCategory QuestionCategory
   */
  ?>
  <?php $this->renderPartial('//snippets/headerGallery');?>
  <!-- header end-->
  <div class="wrapper content-wrapper">
      <div class="col-wrapper">
          <div class="col2">
              <p class="section-title"><?php echo Yii::t('site', 'Рубрики');?></p>
              <ul class="sidebar-nav">
                  <?php
                  foreach ($questionCategories as $item) {
                      if ($item->id == $currentCategory->id) echo '<li class="active">'; else echo '<li>';
                      echo CHtml::link($item->i18n->name, array('question/index', 'category' => $item->link)), '</li>';
                  }
                  ?>
              </ul>
          </div>
          <div class="col8">
              <h1><?php echo CHtml::encode($this->pageName);?></h1>
              <?php foreach ($questions as $question): ?>
              <div class="faq-box">
                  <div class="question">
                      <span class="faq-indicator">+</span>
                      <a><?php echo $question->i18n->question?></a>
                  </div>
                  <div class="answer text-content" style="display: none;">
                      <?php echo $question->i18n->answer ?>
                  </div>
              </div>
              <?php endforeach;?>
          </div>
          <div class="col2">
              <p class="section-title"><?php echo Yii::t('site','Есть вопросы?');?></p>
  
              <div class="text-content">
                  <?php echo Yii::t('site','Обращайтесь к вашему персональному консультанту.');?>
              </div>
              <?php $this->renderPartial('//snippets/sidebarContacts');?>
          </div>
      </div>
  </div>
  <?php
  /** @var $cs CClientScript */
  $cs = Yii::app()->clientScript;
  $src = <<<JS
  (function(){
      var c = false;
      function open(e){
          var a = $('.answer', e);
          var i = $('.question >.faq-indicator',e);
          i.text('-');
          a.css('display','block');
      }
      function close(e){
          var a = $('.answer', e);
          var i = $('.question >.faq-indicator',e);
          i.text('+');
          a.css('display','none');
      }
      c = $('.faq-box').each(function(){
          var t = this;
          $('.question',this).click(function(){
              if(t!==c) {
                  if(c!==false) close(c);
                  open(t); c = t;
              } else {
                  close(t); c=false;
              }
          });
      });
      c=c[0];
      open(c);
  })();
  JS;
  $cs->registerScript('faq', $src);
  
  ?>