public function assignPageContent(\phpQueryObject $_) { $this->setSynopsis(trim($_['p[itemprop=description]']->text())); if ($duration = $_['[itemprop=duration]']->attr('datetime')) { $this->setLength(new \DateInterval($duration)); } $this->setRating((double) $_['[itemprop=ratingValue]']->text()); $this->setTitle(trim($_['h1 [itemprop=name]']->text())); $this->setVotes((int) preg_replace('/[^\\d]+/', '', $_['[itemprop=ratingCount]']->text())); $this->setPosterUri($_['img[itemprop=image]']->attr('src')); $this->setDatePublished(\DateTime::createFromFormat('Y-m-d', $_['.infobar [itemprop="datePublished"]']->attr('content'))); $g = []; foreach ($_['.infobar [itemprop=genre]'] as $genre) { $g[] = pq($genre)->text(); } $this->setGenres($g); foreach ($_['#title-overview-widget [itemtype="http://schema.org/Person"][itemprop!=actors]'] as $x) { $x = pq($x); foreach ($x['a[itemprop=url]'] as $p) { $p = pq($p); $person = new Person(); $person->setId(preg_replace('@^.*(nm\\d+).*@', '$1', $p->attr('href'))); $person->setName($p->text()); if (!isset($this->_people[$x->attr('itemprop')])) { $this->_people[$x->attr('itemprop')] = []; } $this->_people[$x->attr('itemprop')][$person->getId()] = $person; } } // Casting if (!isset($this->_people['actors'])) { $this->_people['actors'] = []; } foreach ($_['table.cast_list tr:has([itemprop=name])'] as $p) { $p = pq($p); $actor = new Actor(); $actor->setId(preg_replace('@^.*(nm\\d+).*@', '$1', $p['[itemprop=url]']->attr('href'))); $actor->setName($p['[itemprop=name]']->text()); $actor->setCharacter($p['a[href^=/character]']->text()); $this->_people['actors'][$actor->getId()] = $actor; } }
} elseif (isset($_POST["nameUpdateSystem"])) { $nameUpdateSystem = $_POST['nameUpdateSystem']; $system = new System(); $system->setName($nameUpdateSystem); $systemId = $_SESSION["systemId"]; $system->updateSystem($systemId); } elseif (isset($_POST["nameUpdateAutor"])) { $nameUpdateAutor = $_POST['nameUpdateAutor']; $autor = new Autor(); $autor->setName($nameUpdateAutor); $autorId = $_SESSION["autorId"]; $autor->updateAutor($autorId); } elseif (isset($_POST["nameUpdateActor"])) { $nameUpdateActor = $_POST['nameUpdateActor']; $actor = new Actor(); $actor->setName($nameUpdateActor); $actorId = $_SESSION["actorId"]; $actor->updateActor($actorId); } $categoryList = Category::getAllCategory(); $_SESSION['categoryList'] = $categoryList; $objectiveList = Objective::getAllObjective(); $_SESSION['objectiveList'] = $objectiveList; $systemList = System::getAllSystem(); $_SESSION['systemList'] = $systemList; $situationList = Situation::getAllSituation(); $_SESSION['situationList'] = $situationList; $actorList = Actor::getAllActor(); $_SESSION['actorList'] = $actorList; $autorList = Autor::getAllAutor(); $_SESSION['autorList'] = $autorList;