public function showMedia()
    {
        $mediaMapper = ($this->container->dataMapper)('MediaMapper');
        $mediaCategoryMapper = ($this->container->dataMapper)('MediaCategoryMapper');

        $data['media'] = $mediaMapper->find();
        $data['categories'] = $mediaCategoryMapper->findCategories();
        $cats = $mediaCategoryMapper->findAllMediaCategoryAssignments();

        // Assign any category ID's to each medium
        foreach ($data['media'] as $key => &$medium) {
            $medium->category = [];
            foreach ($cats as $cat) {
                if ($medium->id === $cat->media_id) {
                    $medium->category[$cat->category_id] = 'on';
                }
            }
        }

        return $this->render('media/media.html', $data);
    }
public function showMedia()
    {
        $mediaMapper = ($this->container->dataMapper)('MediaMapper');
        $mediaCategoryMapper = ($this->container->dataMapper)('MediaCategoryMapper');

        $data['media'] = $mediaMapper->find();
        $data['categories'] = $mediaCategoryMapper->findCategories();
        $cats = $mediaCategoryMapper->findAllMediaCategoryAssignments();

        // Assign any category ID's to each medium
        foreach ($data['media'] as $key => &$medium) {
            $medium->category = [];
            foreach ($cats as $cat) {
                if ($medium->id === $cat->media_id) {
                    $medium->category[$cat->category_id] = 'on';
                }
            }
        }

        return $this->render('media/media.html', $data);
    }
public function showMedia ( ) { $ mediaMapper = ( $ this -> container -> dataMapper ) ( 'MediaMapper' ) ; $ mediaCategoryMapper = ( $ this -> container -> dataMapper ) ( 'MediaCategoryMapper' ) ; $ data [ 'media' ] = $ mediaMapper -> find ( ) ; $ data [ 'categories' ] = $ mediaCategoryMapper -> findCategories ( ) ; $ cats = $ mediaCategoryMapper -> findAllMediaCategoryAssignments ( ) ; // Assign any category ID's to each medium foreach ( $ data [ 'media' ] as $ key => & $ medium ) { $ medium -> category = [ ] ; foreach ( $ cats as $ cat ) { if ( $ medium -> id === $ cat -> media_id ) { $ medium -> category [ $ cat -> category_id ] = 'on' ; } } } return $ this -> render ( 'media/media.html' , $ data ) ; }
Show All Media
Show All Media