예제 #1
0
 /**
  * Returns an array collection of all parallax pages.
  *
  * @param  integer       $parallaxId
  * @param  array|string  $skipPages
  *
  * @return array
  */
 public function getPageCollection($parallaxId, $skipPages = [])
 {
     if (!is_array($skipPages)) {
         $skipPages = [$skipPages];
     }
     $parallax = Parallaxes::find($parallaxId);
     if (!$parallax || !$parallax->pages) {
         return [];
     }
     $pages = json_decode($parallax->pages, true);
     if (!$pages) {
         $pages = [];
     }
     $collection = [];
     foreach ($pages as $parent) {
         if (!$this->_isPageValid($parallaxId, $parent['pagename'], $skipPages)) {
             continue;
         }
         $tempParent = ['title' => $parent['title'], 'pagename' => $parent['pagename'], 'html' => $this->_getHtmlFromFilename($parent['pagename']), 'url' => $this->_getUrlFromFilename($parent['pagename']), 'children' => []];
         if (is_array($parent['children'])) {
             foreach ($parent['children'] as $child) {
                 if (!$this->_isPageValid($parallaxId, $child['pagename'], $skipPages)) {
                     continue;
                 }
                 $tempChild = ['title' => $child['title'], 'pagename' => $child['pagename'], 'html' => $this->_getHtmlFromFilename($child['pagename']), 'url' => $this->_getUrlFromFilename($child['pagename'])];
                 $tempParent['children'][] = $tempChild;
             }
         }
         $collection[] = $tempParent;
     }
     return $collection;
 }
예제 #2
0
 /**
  * Deletes single of multiple items from the list.
  */
 public function index_onDelete()
 {
     if (($ids = post('checked')) && is_array($ids) && count($ids)) {
         foreach ($ids as $id) {
             $parallax = Parallax::find($id);
             if ($parallax) {
                 $parallax->delete();
             }
         }
         Flash::success(Lang::get('freestream.parallax::lang.controllers.parallax.deleted_success'));
     }
     return $this->listRefresh();
 }