public function soclist() { \User::onlyHas('socialc-view'); $pages = \Post::join(\PostLang::getTableName(), \PostLang::getField('post_id'), '=', \Post::getField('id'))->where(\PostLang::getField('lang_id'), \WebAPL\Language::getId())->where(\Post::getField('taxonomy_id'), 1)->orderBy(\PostLang::getField('title'), 'desc')->get(); $page_list = array(); $page_json = array(); foreach ($pages as $page) { $page_list[] = "{$page->post_id}:{$page->title}"; $page_json[$page->post_id] = $page->title; } $data['pagesString'] = implode(';', $page_list); $data['pagesJson'] = json_encode($page_json); $this->layout->content = Template::moduleView($this->module_name, 'views.list', $data); return $this->layout; }
public function getEmpty() { return ['no no no']; // BAD EMPTY FUNCTION // delete posts $posts = Post::where('taxonomy_id', 2)->get(); foreach ($posts as $post) { PostLang::where('post_id', $post->id)->delete(); Files::dropMultiple('post_cover', $post->id); Files::dropMultiple('doc_post', $post->id); Files::dropMultiple('doc_post_lang', $post->id); $post->delete(); } DB::table('apl_feed_field_value')->truncate(); DB::table('apl_feed_post')->truncate(); DB::table(PostLang::getTableName())->update(array('text' => '')); // delete acte $actes = DB::table('apl_acte')->get(); foreach ($actes as $act) { Files::dropMultiple('actelocale', $act->id); } DB::table('apl_acte')->truncate(); // calendar DB::table('apl_calendar_group')->truncate(); DB::table('apl_calendar_item')->truncate(); DB::table('apl_calendar_item_lang')->truncate(); DB::table('apl_calendar_post')->truncate(); // complaint DB::table('apl_complaint')->truncate(); // firechat DB::table('apl_firechat')->truncate(); // gallery $galls = DB::table('apl_gallery')->get(); foreach ($galls as $gal) { Files::dropMultiple('gallery', $gal->id); } DB::table('apl_gallery')->truncate(); DB::table('apl_gallery_post')->truncate(); // reqs $reqs = DB::table('apl_job_requests')->get(); foreach ($reqs as $req) { if ($req->cv_path && file_exists($_SERVER['DOCUMENT_ROOT'] . '/' . $req->cv_path)) { @unlink($_SERVER['DOCUMENT_ROOT'] . '/' . $req->cv_path); } } DB::table('apl_job_requests')->truncate(); // logs DB::table('apl_logs')->truncate(); // newsletter DB::table('apl_newsletter')->truncate(); // persons $persons = DB::table('apl_person')->get(); foreach ($persons as $person) { Files::dropMultiple('person', $person->id); Files::dropMultiple('person_chat', $person->id); } DB::table('apl_person_audience')->truncate(); DB::table('apl_person')->truncate(); DB::table('apl_person_lang')->truncate(); DB::table('apl_person_rel')->truncate(); // polls DB::table('apl_poll')->truncate(); DB::table('apl_poll_answer')->truncate(); DB::table('apl_poll_answer_lang')->truncate(); DB::table('apl_poll_question')->truncate(); DB::table('apl_poll_votes')->truncate(); // pagefiles $pagefiles = DB::table('apl_file')->where('module_name', 'article_cover')->get(); foreach ($pagefiles as $pf) { Files::drop($pf->id); } DB::table('apl_file')->where('module_name', 'page')->delete(); // othfiles $files = DB::table('apl_file')->where('module_name', 'article_cover')->get(); foreach ($files as $file) { Files::drop($file->id); } DB::table('apl_file')->where('module_name', 'article_cover')->delete(); $files = DB::table('apl_file')->where('module_name', 'doc_post_lang')->get(); foreach ($files as $file) { Files::drop($file->id); } DB::table('apl_file')->where('module_name', 'doc_post_lang')->delete(); $files = DB::table('apl_file')->where('module_name', 'test')->get(); foreach ($files as $file) { Files::drop($file->id); } DB::table('apl_file')->where('module_name', 'test')->delete(); $files = DB::table('apl_file')->where('module_name', 'person')->get(); foreach ($files as $file) { Files::drop($file->id); } DB::table('apl_file')->where('module_name', 'person')->delete(); $files = DB::table('apl_file')->where('module_name', 'rewwe')->get(); foreach ($files as $file) { Files::drop($file->id); } DB::table('apl_file')->where('module_name', 'rewwe')->delete(); return ['executed']; }