public function add($parameter) { $category_slug = $parameter[0]; $this->data['title'] = 'Add Post'; $category_model = new Category(); $post_model = new \Models\Post(); $album_model = new Album(); $this->data['album_group'] = $album_model->all(); $this->data['post_category'] = $category_model->getCol('category_slug', $category_slug); // var_dump(count($this->data['post_category'])); if (isset($_POST) && !empty($_POST)) { $post_user_id = Session::get('user_id'); $post_category_id = $_POST['post_category_id']; $post_album_id = $_POST['post_album_id']; $post_title = $_POST['post_title']; $post_body = $_POST['post_body']; $post_link = $_POST['post_link']; $post_excerpt = $_POST['post_excerpt']; $post_slug = Url::generateSafeSlug($post_title); $post_created = time(); $post_array = array('post_user_id' => $post_user_id, 'post_category_id' => $post_category_id, 'post_album_id' => $post_album_id, 'post_title' => $post_title, 'post_body' => $post_body, 'post_link' => $post_link, 'post_excerpt' => $post_excerpt, 'post_slug' => $post_slug, 'post_created' => $post_created); // $insert_array = Gump::xss_clean($insert_array); // $insert_array = Gump::sanitize($insert_array); $post_id = $post_model->create($post_array); //UPLOAD IMAGE if ($_FILES["image"]["tmp_name"] != '') { Upload::setName(uniqid()); Upload::upload_file($_FILES["image"], UPLOAD_PATH); $update_data = array('post_image' => Upload::getFileName('images')); $update = $post_model->updateId($update_data, $post_id); } if ($insert_post_id > 0) { Session::set('success', 'post added'); Url::redirect('post'); } } View::rendertemplate('header', $this->data); View::rendertemplate('sidebar', $this->data); View::render('post/post.add', $this->data); View::rendertemplate('footer', $this->data); }
/** * Define Index page title and load template files */ public function listen($parameter) { $playlistSlug = $parameter[0]; $albumModel = new Album(); $this->data['playlist'] = Album::row('album_slug', $playlistSlug); $this->data['songs'] = \Models\Playlist::items($this->data['playlist']->album_id); $this->data['title'] = 'Listen '; // $albumModel = new \Models\Album; // $albumitemModel = new \Models\Albumitem; // $this->data['slider'] = $albumModel->name('homes'); View::renderTemplate('header', $this->data); View::renderTemplate('sidebar', $this->data); View::render('playlist/listen.playlist', $this->data); View::renderTemplate('footer', $this->data); }
/** * {@inheritDoc} */ public function getImages() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getImages', array()); return parent::getImages(); }
public function playlist() { $this->data['title'] = 'Song Playlists'; if (isset($_POST) && !empty($_POST)) { //generate slug $slug = Url::generateSafeSlug($_POST['title']); $albumArray = array('album_name' => $_POST['title'], 'album_user_id' => Session::get('user_id'), 'album_category_id' => Category::id('category_title', 'playlist'), 'album_description' => $_POST['description'], 'album_slug' => $slug . 'pl', 'album_created' => time()); $albumArray = Gump::xss_clean($albumArray); $albumArray = Gump::sanitize($albumArray); $album_id = $this->albumModel->create($albumArray); if ($album_id > 0) { $checkSlug = $this->albumModel->getColRow('album_slug', $slug); if (!is_bool($checkSlug)) { $updateSlug = $this->albumModel->updateId(array('album_slug' => $slug . 'pl' . $album_id), $album_id); } //UPLOAD ALBUM COVER if ($_FILES["image"]["tmp_name"] != '') { //upload file into uploads folder Upload::setName(time()); Upload::resizeUpload($_FILES["image"], UPLOAD_PATH, 300); $update_data = array('album_image' => Upload::getFileName('images')); $this->albumModel->updateId($update_data, $album_id); } Session::set('success', 'Playlist Created'); } else { Session::set('error', 'Operation Fails'); } } $this->data['albums'] = $this->albumModel->allalbum(); $total = count(Album::type('playlist')); $pages = new Paginator('5', 'p'); $this->data['albums'] = Album::type('playlist', $pages->getLimit()); $pages->setTotal($total); $path = DIR . 'song/playlist?'; $this->data['pageLinks'] = $pages->pageLinks($path, null); View::rendertemplate('header', $this->data); View::rendertemplate('sidebar', $this->data); View::render('song/song.playlist', $this->data); View::rendertemplate('footer', $this->data); }