Exemple #1
0
 public function getImage()
 {
     if (!isset($this->image)) {
         $image_mapper = RequestRegistry::getImageMapper();
         $this->image = $this->getImageId() != 0 ? $image_mapper->findImageForPage($this) : null;
     }
     return $this->image;
 }
Exemple #2
0
 public function getFeaturedImage()
 {
     if (!isset($this->featured_image)) {
         $this->featured_image = RequestRegistry::getImageMapper()->findFeaturedImageForAlbum($this);
     }
     if ($this->featured_image == null) {
         return $this->getFirstImage();
     }
     return $this->featured_image;
 }
 function execute(CommandContext $context)
 {
     $albumMapper = RequestRegistry::getAlbumMapper();
     $imageMapper = RequestRegistry::getImageMapper();
     $album = $context->get('album');
     $images = $album->getImages();
     foreach ($images as $image) {
         $imageMapper->delete($image);
     }
     $albumMapper->delete($album);
     return;
 }
 function execute(CommandContext $context)
 {
     $imageMapper = RequestRegistry::getImageMapper();
     $image = null;
     if ($context->get('image-id') != null) {
         $image = $imageMapper->find($context->get('image-id'));
     }
     if ($context->get('image-slug') != null) {
         $image = $imageMapper->findBySlug($context->get('image-slug'));
     }
     if ($image === null) {
         die("need either 'image-slug' or 'image-id' in the command context please!");
     }
     $context->addParam('image', $image);
     return;
 }
 /**
  * Generates sidebar for a given page object
  *
  * Displays child level pages in a list, if there are any, else nothing
  * TODO Add Approrpiate Image as per funcspec
  * TODO Consider showing sibling pages instead of child
  */
 public function sidebar()
 {
     $children = $this->content->getLiveChildren();
     if (($image = $this->content->getImage()) == null) {
         $image_mapper = RequestRegistry::getImageMapper();
         $pcs_code = SessionRegistry::getStyleCode();
         $image = $image_mapper->findRandomLiveImageForPcs($pcs_code);
     }
     $sidebar = "<div id='sidebar'>\n";
     if (count($children) > 0) {
         $sidebar .= "<div class='sidebar-links-title'>\n" . "<p>{$this->content->getTitle()}</p>\n" . "</div>\n" . "<ul class='sidebar-links-list'>\n";
         foreach ($children as $child) {
             $sidebar .= "<li><a href='{$this->url($child)}'>{$child->getTitle()}</a></li>";
         }
         $sidebar .= "</ul>\n";
     }
     if ($image != null) {
         $sidebar .= "<img src='{$image->getSource()}' id='post-image' />\n";
     }
     $sidebar .= "</div>\n";
     return $sidebar;
 }
 public function execute(CommandContext $context)
 {
     $imageMapper = RequestRegistry::getImageMapper();
     $imageMapper->update($context->get('image'));
     return;
 }
Exemple #7
0
<?php

include '../init.php';
$album = CommandRunner::run('get-album')->get('album');
if (isset($_POST['submit'])) {
    $image_mapper = RequestRegistry::getImageMapper();
    $image = new Image();
    $image->setAlbumId($_POST['album-id']);
    $image_mapper->insert($image);
    $filename = $image->getId() . '.jpg';
    //$target_path = '../img/photos/' . $filename; //*nix Mode
    $target_path = "..\\img\\photos\\" . $filename;
    //Windows Mode
    //var_dump($_FILES);
    //echo $target_path;
    $success = move_uploaded_file($_FILES['uploaded-file']['tmp_name'], $target_path);
    if ($success) {
        $image->setFileName($filename);
        $image_mapper->update($image);
        header('Location: /admin/gallery.php?album-id=' . $_POST['album-id']);
    } else {
        $error_message = "There was a problem with the upload, please try again.";
        $image_mapper->delete($image);
    }
}
include '../inc/doctype.php';
?>
<html>
        <head>
                <title>Immanuel College Admin Panel</title>
                <link rel='stylesheet' type='text/css' href='css/style.css' />
 function execute(CommandContext $context)
 {
     $image = $context->get('image');
     $imageMapper = RequestRegistry::getImageMapper();
     $imageMapper->insert($image);
 }