/**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $datacontentcategory = table_content_category::where('content_category_id', '=', $id)->first();
     $mediaid = $datacontentcategory->media_manager_id;
     $media = table_media_manager::where('media_manager_id', $mediaid)->first();
     if ($media != null) {
         $medianame = $media->media_manager_title;
     } else {
         $medianame = '';
     }
     $data = array('dataContentCategory' => table_content_category::where('content_category_id', '=', $id)->get(), 'media_manager_name' => $medianame, 'media_manager' => json_encode(DB::select('select media_manager_id as id, media_manager_title as label, media_manager_title as value from table_media_manager')));
     return view('admin.database.content-category.content-category-edit', compact('data'));
 }
Ejemplo n.º 2
0
 public function index()
 {
     $result = DB::table('table_content as ct')->select('ct.*', DB::raw('(select content_category_title from table_content_category where content_category_id = ct.content_category_id) as content_category_title'), DB::raw('(select content_title from table_content where content_id = ct.content_repost_from) as content_repost'))->orderBy('content_id', 'desc')->paginate(10);
     foreach ($result as $res => $value) {
         $idsplit = explode(',', $value->content_media_id);
         $length = count($idsplit);
         $name = '';
         for ($i = 0; $i < $length; $i++) {
             $cek = table_media_manager::where('media_manager_id', '=', $idsplit[$i])->first();
             if ($cek != null) {
                 $name = $name . $cek->media_manager_title . ', ';
             }
         }
         $value->content_media_id = $name;
     }
     $data = array('content' => $result);
     return view('admin.database.content.content-index', compact('data'));
 }
Ejemplo n.º 3
0
 public function index()
 {
     $result = table_schedule_type::latest('schedule_type_id')->paginate(10);
     foreach ($result as $res => $value) {
         $idsplit = explode(',', $value->media_manager_id);
         $length = count($idsplit);
         $name = '';
         for ($i = 0; $i < $length; $i++) {
             $cek = table_media_manager::where('media_manager_id', '=', $idsplit[$i])->first();
             if ($cek != null) {
                 $name = $name . $cek->media_manager_title . ', ';
             }
         }
         $value->media_manager_id = $name;
     }
     $data = array('schedule-type' => $result);
     return view('admin.database.schedule-type.schedule-type-index', compact('data'));
 }
Ejemplo n.º 4
0
 public function index()
 {
     $result = DB::table('table_schedule as sch')->select('sch.*', DB::raw('(select users_name from table_users_detail where users_id = sch.schedule_users_creator) as users_name_creator'), DB::raw('(select users_name from table_users_detail where users_id = sch.schedule_users_source) as users_name_source'), DB::raw('(select schedule_type_name from table_schedule_type where schedule_type_id = sch.schedule_type_id) as schedule_type_name'))->orderBy('schedule_id', 'desc')->paginate(10);
     foreach ($result as $res => $value) {
         $idsplit = explode(',', $value->schedule_media_id);
         $length = count($idsplit);
         $name = '';
         for ($i = 0; $i < $length; $i++) {
             $cek = table_media_manager::where('media_manager_id', '=', $idsplit[$i])->first();
             if ($cek != null) {
                 $name = $name . $cek->media_manager_title . ', ';
             }
         }
         $value->schedule_media_id = $name;
     }
     $data = array('schedule' => $result);
     return view('admin.database.schedule.schedule-index', compact('data'));
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $data = array('media-manager' => table_media_manager::where('media_manager_id', '=', $id)->get(), 'menu' => 'tables', 'submenu' => 'mediamanager');
     return view('admin.database.media-manager.media-manager-edit', compact('data'));
 }
Ejemplo n.º 6
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $app = app();
     if (Request::has('token')) {
         $token = Request::input('token', '');
         $compare = GlobalLibrary::tokenExtractor($token);
         $users_checker = GlobalLibrary::CheckUsersToken($compare);
         //echo '<pre>'.print_r($compare).'</pre>';
         if ($users_checker[0]) {
             $uname = $users_checker[1];
             $uid = $users_checker[2];
             $email = $users_checker[3];
             //get query
             $result = DB::select('Select ts.*, tud.users_name as users_name_creator, st.schedule_type_name, tud.users_name as users_name_source
                             from table_schedule ts, table_schedule_type st, table_users_detail tud
                             WHERE ts.schedule_type_id = st.content_category_id
                             AND tud.users_id = ts.schedule_users_creator
                             AND ts.schedule_users_creator = ' . $uid . '
                             ORDER BY schedule_id DESC
                         ');
             //this foreach for get media manager name and source
             foreach ($result as $res => $value) {
                 $idsplit = explode(',', $value->schedule_media_id);
                 //get user source
                 $cekuser = table_users_detail::where('users_id', '=', $value->schedule_users_source)->first();
                 if ($cekuser != null) {
                     $value->users_name_source = $cekuser->users_name;
                 }
                 $length = count($idsplit);
                 $name = '';
                 for ($i = 0; $i < $length; $i++) {
                     $cek = table_media_manager::where('media_manager_id', '=', $idsplit[$i])->first();
                     if ($cek != null) {
                         $name = $name . $cek->media_manager_title . ', ';
                     }
                 }
                 $value->schedule_media_id = $name;
             }
             //this code for convert
             $dataConverted = array();
             $app = app();
             $i = 0;
             foreach ($result as $row) {
                 $dataConverted[$i] = $app->make('stdClass');
                 $dataConverted[$i]->id = $row->schedule_id;
                 $dataConverted[$i]->ttl = $row->cschedule_title;
                 $dataConverted[$i]->typ = $row->schedule_type_id;
                 $dataConverted[$i]->suc = $row->schedule_users_creator;
                 $dataConverted[$i]->usc = $row->schedule_users_source;
                 $dataConverted[$i]->dst = $row->schedule_date_start;
                 $dataConverted[$i]->dnd = $row->schedule_date_end;
                 $dataConverted[$i]->des = $row->schedule_description;
                 $dataConverted[$i]->hed = $row->schedule_headline;
                 $dataConverted[$i]->med = $row->schedule_media_id;
                 $dataConverted[$i]->pub = $row->schedule_publish;
                 $dataConverted[$i]->rpt = $row->schedule_repeat;
                 $dataConverted[$i]->uns = $row->users_name_source;
                 $dataConverted[$i]->utn = $row->schedule_type_name;
                 $dataConverted[$i]->unc = $row->users_name_creator;
                 $i++;
             }
             return (new Response(array('status' => true, 'msg' => 'success', 'data' => $dataConverted), 200))->header('Content-Type', "json");
         } else {
             return (new Response(array('status' => false, 'msg' => 'Authentication Failed2'), 200))->header('Content-Type', "json");
         }
     } else {
         return (new Response(array('status' => false, 'msg' => 'Authentication Failed1'), 200))->header('Content-Type', "json");
     }
 }
Ejemplo n.º 7
0
 public function search_content()
 {
     $app = app();
     if (Request::has('token')) {
         $token = Request::input('token', '');
         $compare = GlobalLibrary::tokenExtractor($token);
         $users_checker = GlobalLibrary::CheckUsersToken($compare);
         //echo '<pre>'.print_r($compare).'</pre>';
         if ($users_checker[0]) {
             $uname = $users_checker[1];
             $uid = $users_checker[2];
             $email = $users_checker[3];
             $users = table_users_detail::where('users_email', '=', $email)->where('users_name', '=', $uname)->where('users_detail_id', '=', $uid)->first();
             $follow = $users->users_json_following;
             //get query
             $keyword = Request::input('qwr');
             $result = DB::select('Select tc.*, tud.users_name, tcc.content_category_title
                             from table_content_category tcc, table_content tc, table_users_detail tud
                             WHERE tc.content_category_id = tcc.content_category_id
                             AND tud.users_id = tc.content_users_uploader
                             AND tc.content_title like ' . $keyword . '
                         ');
             foreach ($result as $res => $value) {
                 //get media manager
                 $idsplit = explode(',', $value->content_media_id);
                 $length = count($idsplit);
                 $name = '';
                 for ($i = 0; $i < $length; $i++) {
                     $cek = table_media_manager::where('media_manager_id', '=', $idsplit[$i])->first();
                     if ($cek != null) {
                         $name = $name . $cek->media_manager_title . ', ';
                     }
                 }
                 //get content repost
                 $cekrepost = table_content::where('content_id', '=', $value->content_repost_from)->first();
                 if ($cekrepost != null) {
                     $value->content_repost_from = $cekrepost->content_title;
                 }
                 //get hashtag
                 $idsplittag = explode(',', $value->hashtag_id);
                 $lengthtag = count($idsplittag);
                 $hashtag = '';
                 for ($j = 0; $j < $lengthtag; $j++) {
                     $cektag = table_hashtag::where('hashtag_id', '=', $idsplittag[$j])->first();
                     if ($cektag != null) {
                         $hashtag = $hashtag . $cektag->media_manager_title . ', ';
                     }
                 }
                 $value->hashtag_id = $hashtag;
             }
             //this code for convert
             $dataConverted = array();
             $app = app();
             $i = 0;
             foreach ($result as $row) {
                 $dataConverted[$i] = $app->make('stdClass');
                 $dataConverted[$i]->id = $row->content_id;
                 $dataConverted[$i]->ttl = $row->ccontent_title;
                 $dataConverted[$i]->hed = $row->content_headline;
                 $dataConverted[$i]->det = $row->content_detail;
                 $dataConverted[$i]->med = $row->content_media_id;
                 $dataConverted[$i]->upl = $row->content_users_uploader;
                 $dataConverted[$i]->uun = $row->content_users_uploader_name;
                 $dataConverted[$i]->cle = $row->content_last_editor;
                 $dataConverted[$i]->cdi = $row->content_date_insert;
                 $dataConverted[$i]->cdu = $row->content_date_update;
                 $dataConverted[$i]->cde = $row->content_date_expired;
                 $dataConverted[$i]->pub = $row->content_publish;
                 $dataConverted[$i]->cat = $row->content_category_id;
                 $dataConverted[$i]->ccn = $row->content_category_name;
                 $dataConverted[$i]->chi = $row->content_hashtag_id;
                 $dataConverted[$i]->crf = $row->content_repost_from;
                 $dataConverted[$i]->crn = $row->content_repost;
                 $i++;
             }
             return (new Response(array('status' => true, 'msg' => 'success', 'data' => $dataConverted), 200))->header('Content-Type', "json");
         } else {
             return (new Response(array('status' => false, 'msg' => 'Authentication Failed2'), 200))->header('Content-Type', "json");
         }
     } else {
         return (new Response(array('status' => false, 'msg' => 'Authentication Failed1'), 200))->header('Content-Type', "json");
     }
 }