Example #1
0
 /**
  * define page title and load template files
  */
 public function index($category_title, $category_slug)
 {
     $this->data['title'] = 'Manage Posts';
     $total = count(PostModel::category($category_title, $category_slug));
     $pages = new Paginator('4', 'p');
     $this->data['post_content'] = PostModel::category($category_title, $category_slug, $pages->getLimit());
     $pages->setTotal($total);
     $path = DIR . 'post/' . $category_title . '/' . $category_slug . '?';
     $this->data['page_links'] = $pages->pageLinks($path, null);
     View::rendertemplate('header', $this->data);
     View::rendertemplate('sidebar', $this->data);
     View::render('post/post.index', $this->data);
     View::rendertemplate('footer', $this->data);
 }
Example #2
0
 /**
  * define page title and load template files
  */
 public function index()
 {
     $this->data['title'] = 'Manage Categories';
     $category_model = new \Models\Category();
     $total = count($category_model->all());
     $pages = new Paginator('10', 'p');
     $this->data['category'] = $category_model->group($pages->getLimit());
     $pages->setTotal($total);
     $path = DIR . 'category?';
     $this->data['page_links'] = $pages->pageLinks($path, null);
     View::rendertemplate('header', $this->data);
     View::rendertemplate('sidebar', $this->data);
     View::render('category/category.index', $this->data);
     View::rendertemplate('footer', $this->data);
 }
Example #3
0
 /**
  * define page title and load template files
  */
 public function index()
 {
     $this->data['title'] = 'Artists';
     $total = count($this->user_model->artist());
     $pages = new Paginator('10', 'p');
     $this->data['artist'] = $this->user_model->artist($pages->getLimit());
     $pages->setTotal($total);
     $path = DIR . 'artist?';
     $this->data['pageLinks'] = $pages->pageLinks($path, null);
     $this->data['title'] = 'Consultants';
     View::rendertemplate('header', $this->data);
     View::rendertemplate('sidebar', $this->data);
     View::render('artist/artist.index', $this->data);
     View::rendertemplate('footer', $this->data);
 }
Example #4
0
 /**
  * Define Index page title and load template files
  */
 public function index()
 {
     $data['title'] = 'Postagens';
     $data['welcome_message'] = 'Lista com todas as postagens';
     //create a new object
     $pages = new \Helpers\Paginator('9', 'p');
     //calling a method to get the records with the limit set (_contacts would be the var holding the model data)
     $data['records'] = $this->posts->getPosts($pages->getLimit());
     //set the total records, calling a method to get the number of records from a model
     $pages->setTotal($data['records'][0]->total);
     //create the nav menu
     $data['pageLinks'] = $pages->pageLinks();
     $data['menu'] = "posts";
     View::renderTemplate('header', $data);
     View::render('posts/lista', $data);
     View::renderTemplate('footer', $data);
 }
Example #5
0
 /**
  * Define Index page title and load template files
  */
 public function index($parameter)
 {
     $this->data['title'] = 'Home';
     $albumModel = new Album();
     // $albumitemModel = new \Models\Albumitem;
     // $this->data['slider'] = $albumModel->name('homes');
     $total = count(Album::type('playlist'));
     $pages = new Paginator('10', 'p');
     $this->data['playlists'] = Album::type('playlist', $pages->getLimit());
     $pages->setTotal($total);
     $path = DIR . 'playlist?';
     $this->data['page_links'] = $pages->pageLinks($path, null);
     View::renderTemplate('header', $this->data);
     View::renderTemplate('sidebar', $this->data);
     View::render('playlist/index.playlist', $this->data);
     View::renderTemplate('footer', $this->data);
 }
Example #6
0
 /**
  * Category : Display all post by category ID and URL
  */
 public function category($id, $url)
 {
     $pages = new Paginator(POSTS_PER_PAGE, 'p');
     $data['posts'] = $this->blog->get_posts_by_category($id, $url, $pages->getLimit());
     $data['posts_total'] = count($this->blog->get_posts_by_category_total($id));
     $pages->setTotal($data['posts_total']);
     $data['pageLinks'] = $pages->pageLinks();
     //var_dump($pages->getInstance()); exit; Pagination en cours
     $data['category'] = $this->blog->get_category($id);
     if (!empty($data['category'][0]->category_title)) {
         $data['title'] = $data['category'][0]->category_title;
     } else {
         $data['title'] = $data['category'][0]->category_name;
     }
     $data['meta_description'] = $data['category'][0]->category_meta_description;
     View::renderTemplate('header', $data);
     View::render('blog/category', $data);
     View::renderTemplate('footer', $data);
 }
Example #7
0
 public function open_share()
 {
     //Receive and transform into array
     $postdata = file_get_contents("php://input");
     $array = json_decode($postdata, true);
     if (isset($_POST)) {
         $array = $_POST;
     }
     //pagination and comment query
     $pages = new \Helpers\Paginator('10', 'p');
     $share = $this->post->getShare($array['share_post_id'], $pages->getLimit());
     $pages->setTotal($share[0]->total);
     echo json_encode(array("share" => $share));
 }
Example #8
0
 /**
  * display album songs and add song
  */
 public function item($param)
 {
     $album_id = $param[0];
     $songModel = new \Models\Song();
     $tagModel = new \Models\Songtag();
     $this->data['album_id'] = $album_id;
     if (isset($param[1]) && !empty($param[1])) {
         $user_id = $param[1];
     }
     $album_detail = $this->albumModel->find($album_id);
     $this->data['title'] = ucfirst($album_detail->album_name) . ' Album';
     $this->data['artist'] = User::artist();
     $this->data['genre'] = $this->categoryModel->get(array('category_slug' => 'genre'));
     $this->data['tags'] = $this->categoryModel->get(array('category_slug' => 'tag'));
     $this->data['status'] = $this->status_model->get(array('status_slug' => 'album'));
     if (isset($_POST) && !empty($_POST)) {
         $songArray = array('song_album_id' => $album_id, 'song_user_id' => Session::get('user_id'), 'song_artist_id' => $_POST['artist_id'], 'song_genre_id' => $_POST['genre_id'], 'song_status_id' => $_POST['status_id'], 'song_title' => $_POST['title'], 'song_description' => $_POST['description'], 'song_created' => time(), 'song_slug' => Url::generateSafeSlug($_POST['title']));
         $songArray = Gump::xss_clean($songArray);
         $songArray = Gump::sanitize($songArray);
         $song_id = $songModel->create($songArray);
         //attach tags
         // var_dump($_POST['tags']);
         if (count($_POST['tags']) > 0) {
             foreach ($_POST['tags'] as $id) {
                 $tag_id = $tagModel->create(array('songtag_category_id' => $id, 'songtag_song_id' => $song_id));
             }
         }
         if ($song_id > 0) {
             $message = 'ok';
         } else {
             $message = 'no';
         }
         if ($_FILES["mp3"]["tmp_name"] != '') {
             //resize youtube image into uploads folder
             Upload::setName(time());
             Upload::upload_file($_FILES["mp3"], UPLOAD_PATH);
             $filepath = UPLOAD_PATH . Upload::getName();
             $outputMp3 = UPLOAD_PATH . 'encoded_' . Upload::getName();
             //check bitrate
             $bitRate = Audio::bitRateSampleRate($filepath, 'bitrate');
             $duration = Audio::duration($filepath);
             if ($bitRate > 128) {
                 $convertMp3 = Audio::convertMp3($filepath, 128, $outputMp3);
             }
             if (is_file($outputMp3)) {
                 $updateArray = array('song_file' => 'images/encoded_' . Upload::getName(), 'song_duration' => $duration);
                 unlink($filepath);
             } else {
                 $updateArray = array('song_file' => Upload::getFileName('images'), 'song_duration' => $duration);
             }
             $saveMp3 = $songModel->updateId($updateArray, $song_id);
         }
         //UPLOAD SONG COVER
         if ($_FILES["image"]["tmp_name"] != '') {
             //upload file into uploads folder
             Upload::setName(time());
             Upload::resizeUpload($_FILES["image"], UPLOAD_PATH, '450px');
             $update_data = array('song_image' => Upload::getFileName('images'));
             $songModel->updateId($update_data, $song_id);
         }
     }
     if ($message == 'ok') {
         $this->data['success'] = 'Record Added!';
     } else {
         if ($message == 'no') {
             $this->data['error'] = 'Operation Fails!';
         }
     }
     $total = count(\Models\Song::album($album_id));
     $pages = new Paginator('6', 'p');
     $this->data['songs'] = \Models\Song::album($album_id, $pages->getLimit());
     $pages->setTotal($total);
     $path = DIR . 'song/item/' . $album_id . '?';
     $this->data['page_links'] = $pages->pageLinks($path, null);
     View::rendertemplate('header', $this->data);
     View::rendertemplate('sidebar', $this->data);
     View::render('song/song.item', $this->data);
     View::rendertemplate('footer', $this->data);
 }
Example #9
0
 public function allpages()
 {
     $total = count($this->pageModel->pages_contents_mainlink());
     $pages = new Paginator('5', 'p');
     $this->data['pages_contents'] = $this->pageModel->pages_contents($pages->getLimit());
     $pages->setTotal($total);
     $path = DIR . 'page/allpages?';
     $this->data['page_links'] = $pages->pageLinks($path, null);
     View::rendertemplate('header', $this->data);
     View::rendertemplate('sidebar', $this->data);
     View::render('pages/allpages', $this->data);
     View::rendertemplate('footer', $this->data);
 }
Example #10
0
 public function image($param)
 {
     $album_id = $param[0];
     $this->data['album_id'] = $album_id;
     if (isset($param[1]) && !empty($param[1])) {
         $user_id = $param[1];
     }
     $album_detail = $this->albumModel->find($album_id);
     $this->data['title'] = 'Picture Album';
     $total = count($this->mediaModel->media('image'));
     $pages = new Paginator('6', 'p');
     $this->data['albumitems'] = $this->mediaModel->media('image', $pages->getLimit());
     $pages->setTotal($total);
     $path = DIR . 'album/image?';
     $this->data['page_links'] = $pages->pageLinks($path, null);
     View::rendertemplate('header', $this->data);
     View::rendertemplate('sidebar', $this->data);
     View::render('album/album.video', $this->data);
     View::rendertemplate('footer', $this->data);
 }