/** * @param String $url * @param int $id * @return Photo[] */ public static function getPhotos($url) { $xh = new XMLHandler($url); $photoItems = $xh->getNodes("photo"); $photoList = array(); foreach ($photoItems as $photoNode) { $p = new Photo(); $p->setId($photoNode->getElementsByTagName("id")->item(0)->textContent); $p->setAlt($photoNode->getElementsByTagName("htmlAlt")->item(0)->textContent); $p->setOrientation($photoNode->getElementsByTagName("orientation")->item(0)->textContent); //set thumbnail pic and large pic $photoInstancesNode = $photoNode->getElementsByTagName("instance"); foreach ($photoInstancesNode as $pi) { $type = $pi->getElementsByTagName("type")->item(0)->textContent; /* @var $pi DomElement */ if ($type == "Thumbnail") { $p->getThumb()->parsePhotoInstance($pi); } elseif ($type == "Large") { $p->getLarge()->parsePhotoInstance($pi); } elseif ($type == "HighRes") { $p->getHiRes()->parsePhotoInstance($pi); } elseif ($type == "Custom") { $p->getCustom()->parsePhotoInstance($pi); } } $photoList[] = $p; } return $photoList; }
echo $p->getId(); ?> "><img src="images/delete.png" /><img src="images/show.png" /><img src="images/hide.png" /></a> </td> </tr> </table> <?php break; case 'save': //TODO$p=$dao->findById($_REQUEST['id']); $category = $_REQUEST['category']; $season = $_REQUEST['season']; $title = $_REQUEST['title']; $description = $_REQUEST['description']; $unePhoto = new Photo(); $unePhoto->setId($_REQUEST['id']); $unePhoto->setCategory($category); $unePhoto->setSeason($season); $unePhoto->setTitle($title); $unePhoto->setDescription($description); $dao->update($unePhoto); break; case 'hide': $dao->hide($_REQUEST['id']); break; case 'show': $dao->show($_REQUEST['id']); break; case 'del': $dao->delete($_REQUEST['id']); //TODO$p=$dao->findById($_REQUEST['id']);