コード例 #1
0
ファイル: GalleryImage.php プロジェクト: YounessTayer/respond
 /**
  * Adds a image
  *
  * @param {string} $id
  * @param {string} $name
  * @param {string} $caption
  * @param {string} $galleryId
  * @param {string} $siteId
  * @return {array}
  */
 public static function add($id, $name, $url, $thumb, $caption, $galleryId, $siteId)
 {
     $gallery = Gallery::getById($galleryId, $siteId);
     $image = array('id' => $id, 'name' => $name, 'url' => $url, 'thumb' => $thumb, 'caption' => $caption);
     array_push($gallery->images, $image);
     $gallery->save($siteId);
     return $gallery;
 }
コード例 #2
0
 /**
  * Removes the gallery
  *
  * @return Response
  */
 public function remove(Request $request)
 {
     // get request data
     $email = $request->input('auth-email');
     $siteId = $request->input('auth-id');
     // get id
     $id = $request->json()->get('id');
     $gallery = Gallery::getById($id, $siteId);
     if ($gallery !== NULL) {
         $gallery->remove($siteId);
         // return OK
         return response('OK, gallery removed at = ' . $gallery->id, 200);
     }
     return response('Gallery not found', 400);
 }
コード例 #3
0
 /**
  * Removes the gallery image
  *
  * @return Response
  */
 public function remove(Request $request)
 {
     // get request data
     $email = $request->input('auth-email');
     $siteId = $request->input('auth-id');
     // id, galleryId
     $id = $request->json()->get('id');
     $galleryId = $request->json()->get('galleryId');
     // get form
     $gallery = Gallery::getById($galleryId, $siteId);
     if ($gallery != NULL) {
         $index = GalleryImage::getIndexById($id, $galleryId, $siteId);
         array_splice($gallery->images, $index, 1);
         $gallery->save($siteId);
         // get site and user
         $site = Site::getById($siteId);
         $user = User::getByEmail($email, $siteId);
         // re-publish plugins
         Publish::publishPlugins($user, $site);
         return response('Ok', 200);
     }
     return response('Gallery not found', 400);
 }