function testUser($email, $type)
{
    try {
        $client = DynamoDbClientBuilder::get();
        $response = $client->getItem(array('TableName' => UserDAO::$TABLE_NAME, 'Key' => array('email' => array('S' => $email))));
        if (empty($response) || empty($response['Item'])) {
            return false;
        }
        if ($response['Item']['type']['S'] == $type) {
            return true;
        } else {
            return false;
        }
    } catch (Exception $e) {
        echo '<p>Exception reçue : ', $e->getMessage(), "\n</p>";
    }
}
예제 #2
0
         </script>
            <?php 
    } else {
        //print_r($_POST);
        //print_r($_FILES);
        echo "<div hidden>";
        $name = $_FILES['avatar']['name'];
        $email_owner = "admin_off";
        $_type = "admin";
        $children = array();
        // UPLOAD SUR S3
        $s3 = new S3Access(S3ClientBuilder::get());
        $url = $s3->createFile($name, $_FILES['avatar']['tmp_name']);
        //$path);
        // INSERT SUR DYNAMO
        $contentDao = new ContentDAO(DynamoDbClientBuilder::get());
        $content = new Content();
        $content->setUrl($url);
        $content->setEmailOwner($email_owner);
        $content->setName($name);
        $content->setType($_type);
        $contentDao->create($content, $children);
        echo "</div>La slide a été ajouter : <a href='https://s3-eu-west-1.amazonaws.com/cherry-shared-content2/" . $name . "'>" . $name . "</a>";
    }
    ?>
        
   </body>

    <footer class="footer">
                <div class="container-fluid">
                    <img  height="60px" src="img/logo.jpg"/> 
예제 #3
0
include 'head.php';
?>
    <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();
        }
function getContentsChild($child)
{
    $contentsFamilial = $child->getContentByType("family");
    $contentsPedagogique = $child->getContentByType("teacher");
    $contentsMedical = $child->getContentByType("doctor");
    $reponse = array();
    if (count($contentsMedical) > 0) {
        //$reponse[]= 'medical_';
        foreach ($contentsMedical as $contentM) {
            //print_r($contentM);
            $owner = $contentM['M']['owner']['S'];
            $name = $contentM['M']['name']['S'];
            $contentDao = new ContentDAO(DynamoDbClientBuilder::get());
            $contents = $contentDao->getContentsOfUser($owner);
            foreach ($contents as $c) {
                $name2 = $c->getName();
                //echo $name2.' =? '.$name;
                if ($name2 == $name) {
                    $reponse[] = $name;
                    $reponse[] = $c->getUrl();
                }
                //echo $c->getUrl();
                //echo 'temp  '.$reponse;
            }
            //print_r($contents);
        }
    }
    if (count($contentsFamilial) > 0) {
        //$reponse[]= 'family_';
        foreach ($contentsFamilial as $contentF) {
            $owner = $contentF['M']['owner']['S'];
            $name = $contentF['M']['name']['S'];
            $contentDao = new ContentDAO(DynamoDbClientBuilder::get());
            $contents = $contentDao->getContentsOfUser($owner);
            foreach ($contents as $c) {
                $name2 = $c->getName();
                //echo $name2.' =? '.$name;
                if ($name2 == $name) {
                    $reponse[] = $name;
                    $reponse[] = $c->getUrl();
                }
                //echo $c->getUrl();
                //echo 'temp  '.$reponse;
            }
        }
    }
    if (count($contentsPedagogique) > 0) {
        //$reponse[]= 'teaching_';
        foreach ($contentsPedagogique as $contentP) {
            $owner = $contentP['M']['owner']['S'];
            $name = $contentP['M']['name']['S'];
            $contentDao = new ContentDAO(DynamoDbClientBuilder::get());
            $contents = $contentDao->getContentsOfUser($owner);
            foreach ($contents as $c) {
                $name2 = $c->getName();
                //echo $name2.' =? '.$name;
                if ($name2 == $name) {
                    $reponse[] = $name;
                    $reponse[] = $c->getUrl();
                }
                //echo $c->getUrl();
                //echo 'temp  '.$reponse;
            }
        }
    }
    print_r($reponse);
}
예제 #5
0
<?php

$root = "./";
include 'includes.php';
$Adao = new AchievementsDAO(DynamoDbClientBuilder::get());
if (!empty($_GET['email'])) {
    $email = $_GET['email'];
    if (empty($_GET['tuto'])) {
        $tuto = $Adao->getTutorial($email);
        header('Content-Type: application/json');
        $response = json_encode(array($tuto));
        echo $response;
    } else {
        $tuto = $_GET['tuto'];
        echo $tuto;
        $Adao->updateTutorial($email, $tuto);
        echo 'a';
    }
}
?>

예제 #6
0
function deleteFile($child, $type, $adultEmail, $fileName)
{
    $child->deleteContent($fileName, $adultEmail, $type);
    $childDao = new ChildDAO(DynamoDbClientBuilder::get());
    $childDao->update($child);
}