예제 #1
0
파일: Node.php 프로젝트: sintattica/atk
 /**
  * Get the active sections.
  *
  * @param string $tab The currently active tab
  * @param string $mode The current mode ("edit", "add", etc.)
  *
  * @return array active Sections
  */
 public function getActiveSections($tab, $mode)
 {
     $activeSections = [];
     if (is_array($this->m_sectionList[$mode])) {
         foreach ($this->m_sectionList[$mode] as $section) {
             if (substr($section, 0, strlen($tab)) == $tab) {
                 $sectionName = 'section_' . str_replace('.', '_', $section);
                 $key = array('nodetype' => $this->atkNodeUri(), 'section' => $sectionName);
                 $defaultOpen = in_array($section, $this->m_default_expanded_sections);
                 if (State::get($key, $defaultOpen ? 'opened' : 'closed') != 'closed') {
                     $activeSections[] = $section;
                 }
             }
         }
     }
     return $activeSections;
 }
예제 #2
0
 /**
  * Partial handler for section state changes.
  */
 public function partial_sectionstate()
 {
     State::set(array('nodetype' => $this->m_node->atkNodeUri(), 'section' => $this->m_postvars['atksectionname']), $this->m_postvars['atksectionstate']);
 }