Beispiel #1
0
 private function processData()
 {
     if ($this->context == "Data was submitted") {
         $model = new APIModel();
         if ($this->verifyForm()) {
             if ($_SESSION['userid'] == "") {
                 echo "<script>\r\n\t\t\talert('Session variable not working');\r\n\t\t\t</script>";
             }
             $userid = $model->getID($this->userName);
             $albumID = $model->getAlbumID($userid, $this->albumName);
             if ($albumID == "Get ID Fail") {
                 echo "<script>\r\n\t\t\talert('Get ID FAILED!');\r\n\t\t\t</script>";
             }
             $pictureID = $model->getPhotoID($albumID, $this->pictureName);
             $result = $model->addTag($pictureID, $this->tagName, $_SESSION['userid']);
             if ($result == "Creation successful.") {
                 //session_register($this->username);
                 //echo $userID;
                 echo "<script>\r\n\t\t\talert('WE DID IT!');\r\n\t\t\t</script>";
             } else {
                 print $result;
             }
         }
     }
     if ($this->context2 == 1) {
         $model = new APIModel();
         $this->idphoto = $model->photoID($_SESSION['userid']);
         $this->albumList = $model->AlbumList($_SESSION['userid']);
         $this->captionList = $model->pictureTitles($_SESSION['userid']);
         $this->tagList = $model->tagZList($_SESSION['userid']);
         $result = $model->deleteTag($this->idphoto[$this->del], $this->tagList[$this->del]);
         if ($result == 1) {
             print '<script type="text/javascript">';
             print 'alert("The tag ' . $this->tagList[$this->del] . ' from the picture ' . $this->captionList[$this->del] . ' from Album ' . $this->AlbumList[$this->del] . ' is succesfuly deleted")';
             print '</script>';
         } else {
             print '<script type="text/javascript">';
             print 'alert("The tag ' . $this->tagList[$this->del] . ' from the picture ' . $this->captionList[$this->del] . ' from Album ' . $this->AlbumList[$this->del] . ' is NOT succesfuly  DELETED")';
             print '</script>';
         }
     }
 }