original_string: protected function determine_layout() {
          $this->pagelayout = array();
  
          // Break up the layout string into pages.
          $pagelayouts = explode(',0', $this->attempt->layout);
  
          // Strip off any empty last page (normally there is one).
          if (end($pagelayouts) == '') {
              array_pop($pagelayouts);
          }
  
          // File the ids into the arrays.
          // Tracking which is the first slot in each section in this attempt is
          // trickier than you might guess, since the slots in this section
          // may be shuffled, so $section->firstslot (the lowest numbered slot in
          // the section) may not be the first one.
          $unseensections = $this->sections;
          $this->pagelayout = array();
          foreach ($pagelayouts as $page => $pagelayout) {
              $pagelayout = trim($pagelayout, ',');
              if ($pagelayout == '') {
                  continue;
              }
              $this->pagelayout[$page] = explode(',', $pagelayout);
              foreach ($this->pagelayout[$page] as $slot) {
                  $sectionkey = array_search($this->slots[$slot]->section, $unseensections);
                  if ($sectionkey !== false) {
                      $this->slots[$slot]->firstinsection = true;
                      unset($unseensections[$sectionkey]);
                  } else {
                      $this->slots[$slot]->firstinsection = false;
                  }
              }
          }
      }
code: protected function determine_layout() {
          $this->pagelayout = array();
  
          // Break up the layout string into pages.
          $pagelayouts = explode(',0', $this->attempt->layout);
  
          // Strip off any empty last page (normally there is one).
          if (end($pagelayouts) == '') {
              array_pop($pagelayouts);
          }
  
          // File the ids into the arrays.
          // Tracking which is the first slot in each section in this attempt is
          // trickier than you might guess, since the slots in this section
          // may be shuffled, so $section->firstslot (the lowest numbered slot in
          // the section) may not be the first one.
          $unseensections = $this->sections;
          $this->pagelayout = array();
          foreach ($pagelayouts as $page => $pagelayout) {
              $pagelayout = trim($pagelayout, ',');
              if ($pagelayout == '') {
                  continue;
              }
              $this->pagelayout[$page] = explode(',', $pagelayout);
              foreach ($this->pagelayout[$page] as $slot) {
                  $sectionkey = array_search($this->slots[$slot]->section, $unseensections);
                  if ($sectionkey !== false) {
                      $this->slots[$slot]->firstinsection = true;
                      unset($unseensections[$sectionkey]);
                  } else {
                      $this->slots[$slot]->firstinsection = false;
                  }
              }
          }
      }
code_tokens: protected function determine_layout ( ) { $ this -> pagelayout = array ( ) ; // Break up the layout string into pages. $ pagelayouts = explode ( ',0' , $ this -> attempt -> layout ) ; // Strip off any empty last page (normally there is one). if ( end ( $ pagelayouts ) == '' ) { array_pop ( $ pagelayouts ) ; } // File the ids into the arrays. // Tracking which is the first slot in each section in this attempt is // trickier than you might guess, since the slots in this section // may be shuffled, so $section->firstslot (the lowest numbered slot in // the section) may not be the first one. $ unseensections = $ this -> sections ; $ this -> pagelayout = array ( ) ; foreach ( $ pagelayouts as $ page => $ pagelayout ) { $ pagelayout = trim ( $ pagelayout , ',' ) ; if ( $ pagelayout == '' ) { continue ; } $ this -> pagelayout [ $ page ] = explode ( ',' , $ pagelayout ) ; foreach ( $ this -> pagelayout [ $ page ] as $ slot ) { $ sectionkey = array_search ( $ this -> slots [ $ slot ] -> section , $ unseensections ) ; if ( $ sectionkey !== false ) { $ this -> slots [ $ slot ] -> firstinsection = true ; unset ( $ unseensections [ $ sectionkey ] ) ; } else { $ this -> slots [ $ slot ] -> firstinsection = false ; } } } }
docstring: Parse attempt->layout to populate the other arrays the represent the layout.
docstring_tokens: Parse attempt - > layout to populate the other arrays the represent the layout .