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);
}
Ejemplo n.º 2
0
         /*
         
                  echo "<br/><br/>";
         
                 $contentDao02 = new ContentDAO(DynamoDbClientBuilder::get());
                 $contents02 = $contentDao02->getContentsOfUser("admin_off");
                 print_r($contents02);*/
     } else {
         echo "Pas de contenue ayant comme titre \"" . $name . "\" et détenue par \"" . $owner . "admin_off\"";
     }
 } else {
     echo "Pas de valeur transmise ...<br/>En lecture : ";
     //Affiche tous les contenue ayant en owner = admin_on
     $email = "admin_on";
     $contentDao = new ContentDAO(DynamoDbClientBuilder::get());
     $contents = $contentDao->getContentsOfUser($email);
     //print_r($contents);
     $length = count($contents);
     if ($length == 0) {
         echo "aucun document lu";
     }
     for ($i = 0; $i < $length; $i++) {
         $content = $contents[$i];
         $url = $content->getUrl();
         echo $url;
     }
     //DEBUG !!!
     /*
             echo "<br/>Document potentiellement lu :<br/>";
                 $contentDao2 = new ContentDAO(DynamoDbClientBuilder::get());
                 $contents2 = $contentDao2->getContentsOfUser("admin_off");
Ejemplo n.º 3
0
 ?>
                         </tr>
                     </tbody>
                 </table>
                 </div>
            
             <div class="col-md-offset-2  col-md-4">
                 <div class="containerFiles">
                       
                    <!-- mouton.txt <button class="btn btn-danger"> <span class="glyphicon glyphicon-remove"></span> </button> -->
                 </div>
            
                 <div class="filesToAdd none">
                     <?php 
 $contentDao = new ContentDAO(DynamoDbClientBuilder::get());
 $contents = $contentDao->getContentsOfUser($_SESSION['email']);
 $files = array();
 foreach ($contents as $content) {
     array_push($files, $content->getName());
 }
 //$files =['insecte.txt','f2.txt','f3.txt']; //fichiers en dur pour l'instant
 foreach ($files as $file) {
     echo '<div class="newFileRow row"><div class="col-md-8" > <div class="input-group">  <input type="text" class="datepicker form-control" placeholder="Choisir une date" aria-describedby="basic-addon2"><span class="input-group-addon" id="basic-addon2">Date de fin</span></div> </div>' . '<div class="col-md-4" > <input type="checkbox" name="file" value="' . $file . '">' . $file . '</div></div> <br/>';
 }
 //<input type="checkbox" name="file" value="' . $file.  '">'.
 //$file  .
 ?>
                    <br/>
                     
                     <button id="addFilesButton" class="btn btn-default">Ajouter les fichiers à l'enfant</button>
                     <span class="ajout"></span>