function sortingFormSucceeded($form = \Nette\Forms\FilterForm)
 {
     $filter = array_filter($form->getValues(TRUE));
     unset($filter["do"], $filter["action"], $filter["category"]);
     $pageDb = new Page($this->database);
     $page = $pageDb->getPageById($form->values->category);
     $this->presenter->redirectUrl("/" . $page->slug . "?" . http_build_query($filter));
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $building = Page::where('url', 'building')->first();
     if (!$building) {
         $building = new Page();
         $building->url = 'building';
         $building->view = 'building';
     }
     $building->is_open = 1;
     $building->save();
 }
 /**
  * Delete page
  */
 function handleDeletePage($id)
 {
     $page = new Model\Page($this->database);
     $pages = $page->getChildren($id);
     $pages[] = $id;
     foreach ($pages as $item) {
         echo 1;
         $doc = new Model\Document($this->database);
         $doc->delete($item);
         Model\IO::removeDirectory(APP_DIR . '/media/' . $item);
     }
     $this->redirect(this, array("id" => null, "type" => $this->getParameter("type")));
 }
 /**
  * @param $result
  * @return IHolder
  */
 public function populate($result)
 {
     $holder = new \App\Holder\Results\Base\Page();
     if (isset($result["page_id_page"])) {
         $holder->setPage(Service::populateEntity($result, \App\Model\Page::getClassName(), "page"));
     }
     if (isset($result["website_id_website"])) {
         $holder->setWebsite(Service::populateEntity($result, \App\Model\Website::getClassName(), "website"));
     }
     if (isset($result["total_subquestions"])) {
         $holder->setTotalSubquestions((int) $result["total_subquestions"]);
     }
     if (isset($result["total_correct_subquestions"])) {
         $holder->setTotalCorrectSubquestions((int) $result["total_correct_subquestions"]);
     }
     if (isset($result["total_almost_subquestions"])) {
         $holder->setTotalAlmostSubquestions((int) $result["total_almost_subquestions"]);
     }
     if (isset($result["total_disqualified_subquestions"])) {
         $holder->setTotalDisqualifiedSubquestions((int) $result["total_disqualified_subquestions"]);
     }
     if (isset($result["total_wrong_subquestions"])) {
         $holder->setTotalWrongSubquestions((int) $result["total_wrong_subquestions"]);
     }
     if (isset($result["total_correct_subquestions_percents"])) {
         $holder->setTotalCorrectSubquestionsPercents((double) $result["total_correct_subquestions_percents"]);
     }
     return $holder;
 }
 /**
  * @param \App\Filter\Results\Websites $filter
  * @return \App\Holder\Results\Base\Page
  */
 public function getResultsWebsites($filter)
 {
     $query = $this->entityManager->getRepository($this->repositoryName)->createQueryBuilder();
     $query->select("website");
     $query->addSelect("count(distinct subquestion.id_subquestion) as total_subquestions");
     $query->addSelect("countif('state','=','1') as total_correct_subquestions");
     $query->addSelect("countif('state','=','2') as total_almost_subquestions");
     $query->addSelect("countif('state','=','0') as total_wrong_subquestions");
     $query->addSelect("countif('state','=','3') as total_disqualified_subquestions");
     $query->addSelect("round((countif('state','=','1') / (countif('state','=','0') + countif('state','=','1') + countif('state','=','2')))*100,2) as total_correct_subquestions_percents");
     $query->from(\App\Model\Website::getClassName(), "website");
     $query->join(\App\Model\Page::getClassName(), "page", Join::WITH, "page.id_website = website.id_website")->addSelect("website");
     $query->leftJoin(\App\Model\Question::getClassName(), "question", Join::WITH, "page.id_page = question.id_page");
     $query->leftJoin(\App\Model\Subquestion::getClassName(), "subquestion", Join::WITH, "question.id_question = subquestion.id_question");
     $query->andWhere($query->expr()->eq("website.visible", 1));
     $query->andWhere($query->expr()->eq("page.visible", 1));
     if ($filter !== null) {
         $this->createNumberCondition($filter->getIdsWebsites(), $query, "website.id_website");
         $this->createNumberCondition($filter->getSubquestions(), $query, "count(distinct subquestion.id_subquestion)", true);
         $this->createNumberCondition($filter->getCorrect(), $query, "countif('state','=','1')", true);
         $this->createNumberCondition($filter->getAlmost(), $query, "countif('state','=','2')", true);
         $this->createNumberCondition($filter->getWrong(), $query, "countif('state','=','0')", true);
         $this->createNumberCondition($filter->getDisqualified(), $query, "countif('state','=','3')", true);
         $this->createNumberCondition($filter->getPercentages(), $query, "round((countif('state','=','1') / (countif('state','=','0') + countif('state','=','1') + countif('state','=','2')))*100,2)", true);
         if (is_array($filter->getOrderBy()) && count($filter->getOrderBy()) > 0) {
             $this->createOrders($filter->getOrderBy(), $query);
         } else {
             $query->orderBy("website.id_website");
         }
     }
     $query->groupBy("website.id_website");
     return $this->getHolders($query, new \App\Holder\Mapper\Results\Base\Website());
 }
 public function run()
 {
     DB::table('pages')->delete();
     for ($i = 0; $i < 10; $i++) {
         Page::create(['titile' => 'Titile' . $i, 'slug' => 'first-page', 'body' => 'Body ' . $i, 'user_id' => 1]);
     }
 }
 /**
  * @param $result
  * @return \App\Holder\PageRelated
  */
 public function populate($result)
 {
     $holder = new \App\Holder\PageRelated();
     if (isset($result["page_related_id_page_related"])) {
         $holder->setPageRelated(Service::populateEntity($result, \App\Model\PageRelated::getClassName(), "page_related"));
     }
     $page_a = new \App\Holder\Page();
     if (isset($result["page_a_id_page"])) {
         $page_a->setPage(Service::populateEntity($result, \App\Model\Page::getClassName(), "page_a"));
     }
     if (isset($result["website_a_id_website"])) {
         $page_a->setWebsite(Service::populateEntity($result, \App\Model\Website::getClassName(), "website_a"));
     }
     if (isset($result["wireframe_a_id_wireframe"])) {
         $page_a->setCurrentWireframe(Service::populateEntity($result, \App\Model\Wireframe::getClassName(), "wireframe_a"));
     }
     $holder->setPageA($page_a);
     $page_b = new \App\Holder\Page();
     if (isset($result["page_b_id_page"])) {
         $page_b->setPage(Service::populateEntity($result, \App\Model\Page::getClassName(), "page_b"));
     }
     if (isset($result["website_b_id_website"])) {
         $page_b->setWebsite(Service::populateEntity($result, \App\Model\Website::getClassName(), "website_b"));
     }
     if (isset($result["wireframe_b_id_wireframe"])) {
         $page_b->setCurrentWireframe(Service::populateEntity($result, \App\Model\Wireframe::getClassName(), "wireframe_b"));
     }
     $holder->setPageB($page_b);
     return $holder;
 }
Exemple #8
0
 public function pList($categorySlug)
 {
     $pag = config('courier.pagination');
     $pages = Page::where('active', 1)->orderBy('id', 'desc')->with(['category' => function ($query) use($categorySlug) {
         $query->where('slug', $categorySlug);
     }])->paginate($pag);
     return view('pblog::blog.list', ['posts' => $pages]);
 }
Exemple #9
0
 public function delete(Request $request)
 {
     if ($request->ajax()) {
         $ids = $request->input('ids');
         $status = true;
         $status = PageModel::whereIn("pag_id", $ids)->update(["pag_status_cd" => "DEL"]) ? true : false;
         if ($status) {
             return Redirect::route('pageHome');
         } else {
             return "error";
         }
     }
 }
 /**
  * @param $result
  * @return \App\Holder\Page
  */
 public function populate($result)
 {
     $holder = new \App\Holder\Page();
     if (isset($result["page_id_page"])) {
         $holder->setPage(Service::populateEntity($result, \App\Model\Page::getClassName(), "page"));
     }
     if (isset($result["website_id_website"])) {
         $holder->setWebsite(Service::populateEntity($result, Website::getClassName(), "website"));
     }
     if (isset($result["wireframe_id_wireframe"])) {
         $holder->setCurrentWireframe(Service::populateEntity($result, Wireframe::getClassName(), "wireframe"));
     }
     return $holder;
 }
Exemple #11
0
 public function index(Request $request)
 {
     $slug = $request->route('slug');
     $isCategory = PageModel::where('pag_slug', $slug)->pluck('pag_cat_id');
     $datas = "";
     $page = "";
     if ($isCategory > 0) {
         $datas = DB::table('CATEGORY as cat')->join('POST as pos', function ($join) {
             $join->on('pos.cat_id', '=', 'cat.cat_id');
         })->where('cat.cat_id', '=', $isCategory)->select('pos.pos_id', 'pos.pos_name', 'pos_image', 'pos_sum')->get();
     } else {
         $page = PageModel::where('pag_slug', $slug)->first(['pag_desc']);
     }
     $menus = $this->getMenu();
     return view('front.page', compact('datas', 'menus', 'page'));
 }
 public function show($id)
 {
     $id = htmlspecialchars($id);
     $page = Page::where('url', $id)->isOpen()->first();
     if ($page) {
         ++$page->views;
         $page->save();
         if ($page->openurl != '') {
             return Redirect::to(strip_tags($page->openurl));
         } else {
             return view('page.' . $page->view, array('page' => $page));
         }
     } else {
         return Redirect::to('/');
     }
 }
 /**
  * @param $result
  * @return \App\Holder\Subquestion
  */
 public function populate($result)
 {
     $holder = new \App\Holder\Subquestion();
     if (isset($result["wireframe_id_wireframe"])) {
         $holder->setWireframe(Service::populateEntity($result, Wireframe::getClassName(), "wireframe"));
     }
     if (isset($result["subquestion_id_subquestion"])) {
         $holder->setSubquestion(Service::populateEntity($result, \App\Model\Subquestion::getClassName(), "subquestion"));
     }
     if (isset($result["question_id_question"])) {
         $holder->setQuestion(Service::populateEntity($result, Question::getClassName(), "question"));
     }
     if (isset($result["page_id_page"])) {
         $holder->setPage(Service::populateEntity($result, Page::getClassName(), "page"));
     }
     if (isset($result["website_id_website"])) {
         $holder->setWebsite(Service::populateEntity($result, Website::getClassName(), "website"));
     }
     return $holder;
 }
 /**
  * @param $result
  * @return IHolder
  */
 public function populate($result)
 {
     $holder = new \App\Holder\Results\Base\Question();
     if (isset($result["question_id_question"])) {
         $holder->setQuestion(Service::populateEntity($result, \App\Model\Question::getClassName(), "question"));
     }
     if (isset($result["subquestion_id_subquestion"])) {
         $holder->setSubquestion(Service::populateEntity($result, \App\Model\Subquestion::getClassName(), "subquestion"));
     }
     if (isset($result["page_id_page"])) {
         $holder->setPage(Service::populateEntity($result, \App\Model\Page::getClassName(), "page"));
     }
     if (isset($result["website_id_website"])) {
         $holder->setWebsite(Service::populateEntity($result, \App\Model\Website::getClassName(), "website"));
     }
     if (isset($result["respondent_id_respondent"])) {
         $holder->setRespondent(Service::populateEntity($result, \App\Model\Respondent::getClassName(), "respondent"));
     }
     if (isset($result["respondentwebsite_id_respondent_website"])) {
         $holder->setRespondentWebsite(Service::populateEntity($result, \App\Model\RespondentWebsite::getClassName(), "respondentwebsite"));
     }
     return $holder;
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     return view('AdminHome')->withPages(Page::paginate(7));
 }
 /**
  * @param \App\Filter\Results\Subquestions $filter
  * @return \App\Holder\Results\Base\Question[]
  */
 public function getResultsSubquestion($filter = null)
 {
     $query = $this->entityManager->getRepository($this->repositoryName)->createQueryBuilder();
     $query->select("subquestion");
     $query->addSelect("question");
     $query->from(Model\Subquestion::getClassName(), "subquestion");
     $query->join(Model\Question::getClassName(), "question", Join::WITH, "subquestion.id_question = question.id_question")->addSelect("question");
     $query->join(Model\Page::getClassName(), "page", Join::WITH, "question.id_page = page.id_page")->addSelect("page");
     $query->join(Model\Website::getClassName(), "website", Join::WITH, "page.id_website = website.id_website")->addSelect("website");
     $query->join(Model\Respondent::getClassName(), "respondent", Join::WITH, "question.id_respondent = respondent.id_respondent")->addSelect("respondent");
     $query->leftJoin(Model\RespondentWebsite::getClassName(), "respondentwebsite", Join::WITH, $query->expr()->andX($query->expr()->eq('respondent.id_respondent', 'respondentwebsite.id_respondent'), $query->expr()->eq('website.id_website', 'respondentwebsite.id_website')))->addSelect("respondentwebsite");
     if ($filter !== null) {
         $this->createNumberCondition($filter->getIdRespondents(), $query, "respondent.id_respondent");
         $this->createNumberCondition($filter->getIdWireframe(), $query, "subquestion.id_wireframe");
         $this->createNumberCondition($filter->getSeconds(), $query, "subquestion.seconds");
         $this->createNumberCondition($filter->getTypes(), $query, "subquestion.question_type");
         $this->createNumberCondition($filter->getState(), $query, "subquestion.state");
         $this->createNumberCondition($filter->getKnowns(), $query, "respondentwebsite.period");
         $this->createNumberCondition($filter->getPages(), $query, "page.id_page");
         $this->createNumberCondition($filter->getWebsites(), $query, "website.id_website");
         $this->createNumberCondition($filter->getDatetimes(), $query, "subquestion.datetime");
         $this->createNumberCondition($filter->getIds(), $query, "subquestion.id_subquestion");
         $this->createNumberCondition($filter->getIdsQuestions(), $query, "question.id_question");
         $this->createStringCondition($filter->getAnswer(), $query, "subquestion.answer", "subquestion.answer");
         $this->createStringCondition($filter->getReason(), $query, "subquestion.reason", "subquestion.answer");
     }
     if (is_array($filter->getOrderBy()) && count($filter->getOrderBy()) > 0) {
         $this->createOrders($filter->getOrderBy(), $query);
     } else {
         $query->orderBy("subquestion.id_subquestion", "desc");
     }
     return $this->getHolders($query, new \App\Holder\Mapper\Results\Base\Question());
 }
 public function getDetail()
 {
     if (!Request::input('id') || Request::input('id') == '') {
         return redirect('admin/Page');
     }
     $id = Request::input('id');
     $data = array();
     $data = Page::find($id);
     $this->page['title'] = 'Page';
     return view("layout.admin.Page.detail", $data)->with('page', $this->page);
 }
 /**
  * @param \App\Filter\PageRelated $filter
  * @return \App\Holder\PageRelated[]
  */
 public function getRelatedPagesByFilter(\App\Filter\PageRelated $filter)
 {
     $query = $this->entityManager->getRepository($this->repositoryName)->createQueryBuilder();
     $query->select("page_related");
     $query->from(\App\Model\PageRelated::getClassName(), "page_related");
     $query->join(\App\Model\Page::getClassName(), "page_a", Join::WITH, "page_related.id_page_a = page_a.id_page")->addSelect("page_a");
     $query->join(\App\Model\Page::getClassName(), "page_b", Join::WITH, "page_related.id_page_b = page_b.id_page")->addSelect("page_b");
     $query->join(\App\Model\Website::getClassName(), "website_a", Join::WITH, "page_a.id_website = website_a.id_website")->addSelect("website_a");
     $query->join(\App\Model\Website::getClassName(), "website_b", Join::WITH, "page_b.id_website = website_b.id_website")->addSelect("website_b");
     $query->join(\App\Model\Wireframe::getClassName(), "wireframe_a", Join::WITH, "page_a.id_page = wireframe_a.id_page")->addSelect("wireframe_a");
     $query->join(\App\Model\Wireframe::getClassName(), "wireframe_b", Join::WITH, "page_b.id_page = wireframe_b.id_page")->addSelect("wireframe_b");
     if ($filter->getGroupBy()) {
         $query->addSelect("concat(least(website_a.id_website, website_b.id_website),'_',greatest(website_a.id_website,website_b.id_website)) as g");
     }
     if ($filter->getIdsPage() !== null && count($filter->getIdsPage()) > 0) {
         $query->andWhere($query->expr()->in("page_a.id_page", $filter->getIdsPage()));
         $query->orWhere($query->expr()->in("page_b.id_page", $filter->getIdsPage()));
     }
     if ($filter->isDuel()) {
         $query->andWhere($query->expr()->eq("page_related.duel", 1));
     }
     if ($filter->getIdsPageRelated() !== null && count($filter->getIdsPageRelated()) > 0) {
         $query->andWhere($query->expr()->in("page_related.id_page_related", $filter->getIdsPageRelated()));
     }
     if ($filter->getIdPage() !== null) {
         $query->andWhere($query->expr()->eq("page_a.id_page", $filter->getIdPage()));
         $query->andWhere($query->expr()->eq("page_b.id_page", $filter->getIdPage()));
     }
     if ($filter->isRequiredColor()) {
         $query->andWhere($query->expr()->isNotNull("page_a.dominant_color"));
         $query->andWhere($query->expr()->isNotNull("page_b.dominant_color"));
     }
     if ($filter->isRequiredTextColor()) {
         $query->andWhere($query->expr()->isNotNull("page_a.dominant_text_color"));
         $query->andWhere($query->expr()->isNotNull("page_b.dominant_text_color"));
     }
     if ($filter->getTextMode() !== null) {
         $query->andWhere($query->expr()->eq("wireframe_a.text_mode", $filter->getTextMode()));
         $query->andWhere($query->expr()->eq("wireframe_b.text_mode", $filter->getTextMode()));
     }
     if ($filter->getImageMode() !== null) {
         $query->andWhere($query->expr()->eq("wireframe_a.image_mode", $filter->getImageMode()));
         $query->andWhere($query->expr()->eq("wireframe_b.image_mode", $filter->getImageMode()));
     }
     if ($filter->getDevices() !== null && count($filter->getDevices()) > 0) {
         $query->andWhere($query->expr()->in("wireframe_a.device", $filter->getDevices()));
         $query->andWhere($query->expr()->in("wireframe_b.device", $filter->getDevices()));
     }
     if ($filter->getMinResolutionWidth() !== null) {
         $query->andWhere($query->expr()->gte("wireframe_a.resolution_width", $filter->getMinResolutionWidth()));
         $query->andWhere($query->expr()->gte("wireframe_b.resolution_width", $filter->getMinResolutionWidth()));
     }
     if ($filter->getMinResolutionHeight() !== null) {
         $query->andWhere($query->expr()->gte("wireframe_a.resolution_height", $filter->getMinResolutionHeight()));
         $query->andWhere($query->expr()->gte("wireframe_b.resolution_height", $filter->getMinResolutionHeight()));
     }
     if ($filter->getMaxResolutionWidth() !== null) {
         $query->andWhere($query->expr()->lte("wireframe_a.resolution_width", $filter->getMaxResolutionWidth()));
         $query->andWhere($query->expr()->lte("wireframe_b.resolution_width", $filter->getMaxResolutionWidth()));
     }
     if ($filter->getMaxResolutionHeight() !== null) {
         $query->andWhere($query->expr()->lte("wireframe_a.resolution_height", $filter->getMaxResolutionHeight()));
         $query->andWhere($query->expr()->lte("wireframe_b.resolution_height", $filter->getMaxResolutionHeight()));
     }
     if ($filter->getLanguages() !== null && count($filter->getLanguages()) > 0) {
         $query->andWhere($query->expr()->in("website_a.language", $filter->getLanguages()));
         $query->andWhere($query->expr()->in("website_b.language", $filter->getLanguages()));
     }
     if ($filter->isPriority() !== null) {
         $query->andWhere($query->expr()->eq("page_a.priority", $filter->isPriority() ? 1 : 0));
         $query->andWhere($query->expr()->eq("page_b.priority", $filter->isPriority() ? 1 : 0));
     }
     if ($filter->getExcludeIdPage() !== null && count($filter->getExcludeIdPage()) > 0) {
         $query->andWhere($query->expr()->notIn("page_a.id_page", $filter->getExcludeIdPage()));
         $query->andWhere($query->expr()->notIn("page_b.id_page", $filter->getExcludeIdPage()));
     }
     if ($filter->getExcludeIdWireframe() !== null && count($filter->getExcludeIdWireframe()) > 0) {
         $query->andWhere($query->expr()->notIn("wireframe_a.id_wireframe", $filter->getExcludeIdWireframe()));
         $query->andWhere($query->expr()->notIn("wireframe_b.id_wireframe", $filter->getExcludeIdWireframe()));
     }
     if ($filter->getCategories() !== null && count($filter->getCategories()) > 0) {
         $query->join(\App\Model\EntityCategory::getClassName(), "entity_category_a", Join::WITH, "website_a.id_website = entity_category_a.id_website");
         $query->join(\App\Model\EntityCategory::getClassName(), "entity_category_b", Join::WITH, "website_b.id_website = entity_category_b.id_website");
         $query->andWhere($query->expr()->in("entity_category_a.id_category", $filter->getCategories()));
         $query->andWhere($query->expr()->in("entity_category_b.id_category", $filter->getCategories()));
     }
     if ($filter->isWebsiteVisible()) {
         $query->andWhere($query->expr()->eq("website_a.visible", 1));
         $query->andWhere($query->expr()->eq("website_b.visible", 1));
     }
     if ($filter->isPageVisible()) {
         $query->andWhere($query->expr()->eq("page_a.visible", 1));
         $query->andWhere($query->expr()->eq("page_b.visible", 1));
     }
     if ($filter->isWireframeVisible()) {
         $query->andWhere($query->expr()->eq("wireframe_a.visible", 1));
         $query->andWhere($query->expr()->eq("wireframe_b.visible", 1));
     }
     if ($filter->getLimit() !== null && $filter->getLimit() > 0) {
         $query->setMaxResults($filter->getLimit());
     }
     if ($filter->getGroupBy()) {
         $query->groupBy("g");
     }
     return $this->getHolders($query, new \App\Holder\Mapper\PageRelated());
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     return view('pages.show')->withPage(Page::find($id));
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $comment = Comment::where('page_id', $id)->delete();
     $page = Page::find($id)->delete();
     return Redirect::to('admin');
 }
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function index()
 {
     return view('home')->withPages(Page::paginate(5));
 }
 public function postDelete($id)
 {
     $id = intval($id);
     $page = Page::find($id);
     if (!$page) {
         return Redirect::to('/admin/pages');
     }
     $page->delete();
     return Response::json(['error' => 0, 'message' => '删除成功!']);
 }
Exemple #23
0
 public function getMenu()
 {
     return Page::where("pag_status_cd", "ACT")->orderBy('pag_order', 'asc')->get(['pag_name', 'pag_slug']);
 }
 public function destroy($id)
 {
     Page::destroy($id);
     return ['error' => 0, 'message' => '删除成功!'];
 }
 /**
  * @return \App\Holder\Page
  */
 public function getBasePageHolders()
 {
     $query = $this->entityManager->getRepository($this->repositoryName)->createQueryBuilder();
     $query->select("page");
     $query->from(Model\Page::getClassName(), "page");
     $query->join(Model\Website::getClassName(), "website", Join::WITH, "page.id_website = website.id_website")->addSelect("website");
     return $this->getHolders($query, new \App\Holder\Mapper\Page());
 }