<?php
  if ( is_array( $this -> _pages ) ) foreach ( $this -> _pages as $page )
  {
    if ( $page['id_menu'] != $_SESSION['id_menu'] )
    {
      $_SESSION['id_menu'] = $page['id_menu'];
      ?>
        <div style="clear: both; background: #DDDDDF; padding: 5px 10px;">--- <?= \admin\factory\Menu::getMenuName( $page['id_menu'] );?> ---</div>
      <?
    }
    ?>
      <div <? if ( $this -> _step > 0 ) echo "style='display: none;'";?> class="article_page article_page_<?= $this -> _step;?> <?= $page['parent_id'];?>" style="float: left; width: 280px;">
        <? if ( $this -> _step == 0 ) echo '&nbsp;';?>
        <input type='checkbox' name='pages[]' value='<?= $page['id'];?>' style='width: 15px; position: relative; top: 5px; float: left; margin-right: 5px;' id="page_<?= $page['id'];?>"
          <?
          if ( $page['check'] == 1 )
            echo 'checked="checked"';
          ?>
        />
        <a id="a_<?= $page['id'];?>" idk="<?= $page['id'];?>" class='select-page'>
          <?= $page['title'];?>
        </a>
        <?
        if ( is_array( $page['subpages'] ) )
          echo '<i class="toggle-pages show" id="' . $page['id'] . '"></i>';
        
        if ( is_array( $page['subpages'] ) )
          echo \admin\view\Layouts::drawLayoutEditPages( $page['subpages'], $this -> _step + 1 );
        ?>
      </div>
    <?
  }
?>
