Ejemplo n.º 1
0
 public function __construct($data)
 {
     $this->_title = $data['title'];
     $this->_groups = array();
     $this->_subsections = array();
     $this->_paragraphs = array();
     if (isset($data['subsection'])) {
         foreach ($data['subsection'] as $value) {
             $this->_subsections[] = new CSection($value);
         }
     }
     if (isset($data['group'])) {
         parent::toArray($data['group']);
         foreach ($data['group'] as $value) {
             $persons = array();
             if (is_string($value['person'])) {
                 var_dump($value);
                 die;
             }
             parent::toArray($value['person']);
             foreach ($value['person'] as $args) {
                 $persons[] = new Person($args);
             }
             if (count($persons) > 0) {
                 $this->_groups[] = array('name' => $value['name'], 'persons' => $persons);
             }
         }
     }
     if (isset($data['paragraph'])) {
         parent::toArray($data['paragraph']);
         $this->_paragraphs = $data['paragraph'];
     }
 }
Ejemplo n.º 2
0
 public function __construct($data)
 {
     $this->_name = $data['name'];
     $this->_category = $data['category'];
     $this->_files = array();
     if (isset($data['image'])) {
         if (!isset($data['image'][0])) {
             parent::toArray($data['image']);
         }
         foreach ($data['image'] as $value) {
             if (isset($value['range'])) {
                 $attr = $value['range']['@attributes'];
                 if (!isset($attr['from']) || !isset($attr['to']) || !isset($attr['format']) || !strstr($value['file'], '#n#')) {
                     throw new ErrorException('Invalid range format for ' . $value['file']);
                 }
                 $pat = str_replace("#n#", $attr['format'], $value['file']);
                 for ($num = $attr['from']; $num <= $attr['to']; $num++) {
                     $this->_files[] = array('filename' => sprintf($pat, $num), 'caption' => $value['caption']);
                 }
             } else {
                 $this->_files[] = array('filename' => $value['file'], 'caption' => $value['caption']);
             }
         }
     }
 }
Ejemplo n.º 3
0
 public function __construct($data)
 {
     $this->_title = $data['title'];
     $this->_anchor = $data['anchor'];
     $this->_baseurl = $data['baseurl'];
     $this->_subsections = array();
     parent::toArray($data['subsection']);
     foreach ($data['subsection'] as $key => $value) {
         $this->_subsections[] = new DSubSection($value, $this->_baseurl);
     }
 }
Ejemplo n.º 4
0
 /**
  * QASection object constructor.
  *
  * @param array $data list containing all qasection data
  * @param int $section_number used in the TOC
  * @param array $xref reference to xref map
  */
 public function QASection($data, $section_number, &$xref)
 {
     $this->_title = $data['title'];
     $this->_entries = array();
     $this->_toc = array();
     parent::toArray($data['entry']);
     $count = 1;
     foreach ($data['entry'] as $key => $value) {
         $qa = new QAEntry($value, $section_number, $count++, $xref);
         $this->_entries[] = $qa;
         $this->_toc[$qa->getHref()] = $qa->getQuestion();
     }
 }
Ejemplo n.º 5
0
 public static function getAllScreenshots()
 {
     $fname = DIR_DATA . '/screenshots.xml';
     $parser = new XMLParser();
     $a = $parser->parseByFilename($fname);
     $entries = array();
     BasicObject::toArray($a['screenshots']['group']);
     foreach ($a['screenshots']['group'] as $value) {
         BasicObject::toArray($value['game']);
         $games = array();
         foreach ($value['game'] as $data) {
             $games[] = new Screenshot($data);
         }
         $entries[] = array('title' => $value['title'], 'category' => $value['category'], 'games' => $games);
     }
     return $entries;
 }
Ejemplo n.º 6
0
 public static function getAllSubprojects()
 {
     $fname = DIR_DATA . '/subprojects.xml';
     $parser = new XMLParser();
     $a = $parser->parseByFilename($fname);
     $entries = array();
     BasicObject::toArray($a['subprojects']['project']);
     foreach ($a['subprojects']['project'] as $key => $value) {
         $downloads = array();
         foreach ($value['entries'] as $type => $data) {
             if ($type == 'file') {
                 BasicObject::toArray($data);
                 foreach ($data as $file) {
                     $downloads[] = new File($file);
                 }
             }
         }
         $entries[] = new Project(array('name' => $value['name'], 'info' => $value['info'], 'downloads' => $downloads));
     }
     return $entries;
 }
Ejemplo n.º 7
0
 public function __construct($data, $baseurl, $baseturl)
 {
     $this->_title = $data['title'];
     $this->_anchor = $data['anchor'];
     $this->_notes = $data['notes'];
     $this->_footer = $data['footer'];
     $this->_files = array();
     $this->_links = array();
     $this->_items = array();
     foreach ($data['entries'] as $type => $item) {
         parent::toArray($item);
         if ($type == 'file') {
             foreach ($item as $file) {
                 $this->_items[] = new File($file, $baseurl, $baseturl);
             }
         } elseif ($type == 'link') {
             foreach ($item as $link) {
                 $this->_items[] = new WebLink($link);
             }
         }
     }
 }