Skip to content

Commit

Permalink
Merge pull request #35 from experius/feature/added-last_visited-collumn
Browse files Browse the repository at this point in the history
[FEATURE][IN23-62] added collumn last visited
  • Loading branch information
DRdevil27 authored Mar 18, 2024
2 parents f72c51e + d7ecbf3 commit 3e65c1e
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 12 deletions.
34 changes: 24 additions & 10 deletions Api/Data/PageNotFoundInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ interface PageNotFoundInterface

const TO_URL = 'to_url';
const COUNT_REDIRECT = 'count_redirect';
const LAST_VISITED = 'last_visited';
const COUNT = 'count';
const FROM_URL = 'from_url';
const PAGE_NOT_FOUND_ID = 'page_not_found_id';
Expand All @@ -17,74 +18,87 @@ interface PageNotFoundInterface
* Get page_not_found_id
* @return string|null
*/

public function getPageNotFoundId();

/**
* Set page_not_found_id
* @param string $page_not_found_id
* @return \Experius\PageNotFound\Api\Data\PageNotFoundInterface
*/

public function setPageNotFoundId($pageNotFoundId);

/**
* Get from_url
* @return string|null
*/

public function getFromUrl();

/**
* Set from_url
* @param string $from_url
* @return \Experius\PageNotFound\Api\Data\PageNotFoundInterface
*/

public function setFromUrl($from_url);

/**
* Get to_url
* @return string|null
*/

public function getToUrl();

/**
* Set to_url
* @param string $to_url
* @return \Experius\PageNotFound\Api\Data\PageNotFoundInterface
*/

public function setToUrl($to_url);

/**
* Get count
* @return string|null
*/

public function getCount();

/**
* Set count
* @param string $count
* @return \Experius\PageNotFound\Api\Data\PageNotFoundInterface
*/

public function setCount($count);

/**
* Get count_redirect
* @return string|null
*/

public function getCountRedirect();

/**
* Set count_redirect
* @param string $count_redirect
* @return \Experius\PageNotFound\Api\Data\PageNotFoundInterface
*/

public function setCountRedirect($count_redirect);

/**
* Get last_visited
* @return string|null
*/
public function getLastVisited();

/**
* Set last_visited
* @param string $last_visited
* @return \Experius\PageNotFound\Api\Data\PageNotFoundInterface
*/
public function setLastVisited($last_visited);
}
19 changes: 19 additions & 0 deletions Model/PageNotFound.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,23 @@ public function setCountRedirect($count_redirect)
{
return $this->setData(self::COUNT_REDIRECT, $count_redirect);
}

/**
* Get last_visited
* @return string
*/
public function getLastVisited()
{
return $this->getData(self::LAST_VISITED);
}

/**
* Set last_visited
* @param string $last_visited
* @return \Experius\PageNotFound\Api\Data\PageNotFoundInterface
*/
public function setLastVisited($last_visited)
{
return $this->setData(self::LAST_VISITED, $last_visited);
}
}
4 changes: 3 additions & 1 deletion Observer/Controller/ActionPredispatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ActionPredispatch implements \Magento\Framework\Event\ObserverInterface
protected $request;

protected $action;

protected $urlParts = [];

private $resultFactory;
Expand Down Expand Up @@ -112,6 +112,8 @@ protected function savePageNotFound($fromUrl){
$pageNotFoundModel = $this->pageNotFoundFactory->create();

$pageNotFoundModel->load($fromUrl,'from_url');
$curentDate = date("Y-m-d");
$pageNotFoundModel->setLastVisited($curentDate);

if($pageNotFoundModel->getId()){
$count = $pageNotFoundModel->getCount();
Expand Down
1 change: 1 addition & 0 deletions etc/db_schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
comment="count"/>
<column xsi:type="int" name="count_redirect" padding="11" unsigned="false" nullable="true" identity="false"
comment="count_redirect"/>
<column xsi:type="date" name="last_visited" nullable="true" comment="count_redirect"/>
<constraint xsi:type="primary" referenceId="PRIMARY">
<column name="page_not_found_id"/>
</constraint>
Expand Down
10 changes: 9 additions & 1 deletion view/adminhtml/ui_component/experius_page_not_found_index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,15 @@
</item>
</argument>
</column>
<actionsColumn class="Experius\PageNotFound\Ui\Component\Listing\Column\PagenotfoundActions" name="actions">
<column name="last_visited">
<settings>
<filter>dateRange</filter>
<dataType>date</dataType>
<dateFormat>yyyy-MM-dd</dateFormat>
<label translate="true">last visited</label>
</settings>
</column>
<actionsColumn class="Experius\PageNotFound\Ui\Component\Listing\Column\PagenotfoundActions" name="actions">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="indexField" xsi:type="string">page_not_found_id</item>
Expand Down

0 comments on commit 3e65c1e

Please sign in to comment.