<title>Content </title> </head> <body> <?php include 'nav.php'; ?> <h1>Gestion de contenus de l'enfant</h1> <?php $root = './'; include "includes.php"; $contentDao = new ContentDAO(DynamoDbClientBuilder::get()); $childDao = new ChildDAO(DynamoDbClientBuilder::get()); $email = $_SESSION['email']; $child = $childDao->get($email); // URL parameter // parameter 'type', possible values : {teacher, family, doctor} $type = $_GET['type']; // use method getContentyType ?? if ($type == 'teacher') { $contents = $child->getTeachingContent(); } else { if ($type == 'family') { $contents = $child->getFamilyContent(); } else { if ($type == 'doctor') { $contents = $child->getMedicalContent(); } } }
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(); } }
<?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'];
<body> <?php include $root . 'nav.php'; ?> <?php $doy = new DaysOfYear(); $year = date('Y'); $calendar = $doy->getAll($year); $access_rights = Rights::$NONE; $child_email = $_GET['email']; $adult_email = $_SESSION['email']; if (!empty($child_email) && !empty($adult_email)) { $childDao = new ChildDAO(DynamoDbClientBuilder::get()); $child = $childDao->get($child_email); $usrDao = new UserDAO(DynamoDbClientBuilder::get()); $user = $usrDao->get($adult_email); if ($child->isFather($user->getEmail())) { $access_rights = Rights::$FULL_ACCESS; // pour l'instant en dur, plus tard dans la base } echo '<span class="email" email="' . $child_email . '"></span>'; echo '<span class="adultEmail" email="' . $adult_email . '" type="' . $user->getType() . '"></span>'; } ?>