Esempio n. 1
0
 public function UpDate($content, $children)
 {
     try {
         $result = $this->client->updateItem(['TableName' => ContentDAO::$TABLE_NAME, 'Key' => array('name' => array('S' => $content->getName()), 'owner' => array('S' => $content->getEmailOwner())), 'ExpressionAttributeNames' => ['#NA' => 'url'], 'ExpressionAttributeValues' => [':val1' => array('S' => $content->getUrl())], 'UpdateExpression' => 'set #NA = :val1 ']);
         // print_r($result);
         /* $this->client->UpdateItem(array(
                'TableName' => ContentDAO::$TABLE_NAME,
                'Key' => array(
                    'name'    => array('S' => $content->getName()),
                    'owner'   => array('S' => $content->getEmailOwner()),
                    'url'     => array('S' => $content->getUrl()),
                    'type'    => array('S' => $content->getType())
                    ),
                'AttributeUpdates' => array(
                    'url'     => array('Value' => array('SS' => $content->getUrl()), 'Action'=>'ADD')
                    )
            ));*/
         $length = count($children);
         $childDAO = new ChildDAO($this->client);
         for ($i = 0; $i < $length; $i++) {
             $email = $children[$i]['email'];
             $child = $childDAO->get($email);
             if ($child != null) {
                 $dateStart = $children[$i]['dateStart'];
                 $dateEnd = $children[$i]['dateEnd'];
                 $child->addContent($content, $dateStart, $dateEnd);
                 $childDAO->update($child);
             }
         }
     } catch (Exception $e) {
         print $e->getMessage();
     }
 }
Esempio n. 2
0
<?php

session_start();
include "includes.php";
$name = $_GET['name'];
$type = $_GET['type'];
if (!empty($type)) {
    $email = $_SESSION['email'];
    $childDAO = new ChildDAO(DynamoDbClientBuilder::get());
    $child = $childDAO->get($email);
    $child->readContent($name, $type);
    $childDAO->update($child);
    echo '<pre>';
    print_r($child->getContentByType($type));
    echo '</pre></br>';
}
$s3 = new S3Access(S3ClientBuilder::get());
$result = $s3->getFile($name);
header("Content-Type: {$result['ContentType']}");
header("Content-Disposition: attachment; filename=\"{$name}\"");
echo $result['Body'];
function deleteFile($child, $type, $adultEmail, $fileName)
{
    $child->deleteContent($fileName, $adultEmail, $type);
    $childDao = new ChildDAO(DynamoDbClientBuilder::get());
    $childDao->update($child);
}