Skip to content

Commit

Permalink
1.0.4: #3
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrii-fediuk committed Mar 4, 2020
1 parent b8c69ec commit 26faad4
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 33 deletions.
28 changes: 7 additions & 21 deletions Block/Mediaclip/Projects.php
Original file line number Diff line number Diff line change
@@ -1,28 +1,14 @@
<?php

namespace Mangoit\MediaclipHub\Block\Mediaclip;

class Projects extends \Magento\Framework\View\Element\Template
{
protected $_projects;

function __construct(\Magento\Framework\View\Element\Template\Context $context)
{
parent::__construct($context);
}

class Projects extends \Magento\Framework\View\Element\Template {
/**
* 2020-03-04
* @return array
* @throws \Exception
* 2020-03-04 Dmitry Fedyuk https://www.upwork.com/fl/mage2pro
* $project_id looks lik «8c3ffcb2-c451-465a-bf9a-fe1e5b3bc726»
* @used-by vendor/inkifi/mediaclip-legacy/view/frontend/templates/savedproject.phtml
* @param $project_id
* @return string
*/
function getProjects() {
$hubHelper = mc_h();
return $hubHelper->getMediaClipProjects($hubHelper->getCustomerId());
}

function getProjectEditUrl($project_id){

function getProjectEditUrl($project_id) {
$url = "javascript:void(0)";
if ($project_id) {
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
Expand Down
1 change: 0 additions & 1 deletion Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,6 @@ function consolidateCustomerAndGetCustomerToken($storeUserId, $anonymousCustomer

/**
* 2020-03-04
* @used-by \Mangoit\MediaclipHub\Block\Mediaclip\Projects::getProjects()
* @used-by vendor/inkifi/mediaclip-legacy/view/frontend/templates/savedproject.phtml
* @param int|null $userId
* @return array
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "inkifi/mediaclip-legacy"
,"version": "1.0.3"
,"version": "1.0.4"
,"description": "An integration between mediaclip.ca and inkifi.com (Magento 2)"
,"type": "magento2-module"
,"homepage": "https://github.com/inkifi/mediaclip"
Expand Down
1 change: 0 additions & 1 deletion lib/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* 2018-09-11
* @used-by \Mangoit\MediaclipHub\Block\Adminhtml\Product\Edit\Tab\ProductInformation::_prepareForm()
* @used-by \Mangoit\MediaclipHub\Block\Cart\Item\Renderer::getProductUrl()
* @used-by \Mangoit\MediaclipHub\Block\Mediaclip\Projects::getProjects()
* @used-by \Mangoit\MediaclipHub\Controller\Adminhtml\Order\Download::execute()
* @used-by \Mangoit\MediaclipHub\Controller\Cart\Add::execute()
* @used-by \Mangoit\MediaclipHub\Controller\Index\Customizeproject::execute()
Expand Down
3 changes: 0 additions & 3 deletions view/frontend/templates/mediaclip.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,4 @@

</body>
</html>

<?php //echo $this->getLayout()->createBlock('Mangoit\MediaclipHub\Block\Mediaclip\Projects')->setTemplate('Mangoit_MediaclipHub::logincheck.phtml')->toHtml(); ?>

<?php echo $this->getLayout()->createBlock("Magento\Framework\View\Element\Template")->setTemplate("Mangoit_MediaclipHub::logincheck.phtml")->toHtml(); ?>
25 changes: 19 additions & 6 deletions view/frontend/templates/savedproject.phtml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
use Mangoit\MediaclipHub\Block\Mediaclip\Projects as B; /** @var B $block */
if (!($projects = mc_h()->getMediaClipProjects(df_customer_id()))): ?>
<h4><?php echo __('No Projects Found.'); ?></h4>
<?php else: ?>
Expand All @@ -7,9 +8,7 @@ if (!($projects = mc_h()->getMediaClipProjects(df_customer_id()))): ?>
<?php $recordsPerPage = 20; ?>
<?php $projectsArray = array_chunk($projects, $recordsPerPage); ?>
<?php $pages = count($projectsArray); ?>

<?php $class = '';//($class > 1) ? '' : 'no-display'; ?>

<ul class="pagination pagination-lg <?php echo $class; ?>">
<?php
for ($i=1; $i <= $pages; $i++) {
Expand All @@ -23,16 +22,30 @@ if (!($projects = mc_h()->getMediaClipProjects(df_customer_id()))): ?>
<?php foreach ($projectsArray as $value): ?>
<div style="display: none;" id="list<?php echo $i; ?>">
<div id="projects-list" class="row">
<?php foreach ($value as $k => $v): ?>
<?php $projectUrl = $this->getProjectEditUrl($v->id); ?>
<?php foreach ($value as $k => $v) { /** @var array(string => string) $v */
/**
* 2012-03-04 Dmitry Fedyuk https://www.upwork.com/fl/mage2pro
* 1) «Trying to get property of non-object
* in vendor/inkifi/mediaclip-legacy/view/frontend/templates/savedproject.phtml on line 27»:
* https://github.com/inkifi/mediaclip-legacy/issues/3
* 2) $v looks like:
* {
* "createdDateUtc": "2020-03-04T13:47:34.4000000Z",
* "id": "8c3ffcb2-c451-465a-bf9a-fe1e5b3bc726",
* "isShareable": false,
* "lastModifiedDateUtc": "2020-03-04T13:47:59.0070000Z",
* "urlThumb": "https://mc-hub-hubapi-web-use.azurewebsites.net/projects/..."
* }
*/
$projectUrl = $block->getProjectEditUrl($v['id']); ?>
<div class="project-block">
<div class="thumbnail">
<a href="<?php echo $projectUrl; ?>" target="_blank">
<img class="img-rounded" src="<?php echo $v->urlThumb; ?>" alt="Project#<?php echo $j ?>" style="width:100%; height:150px">
<img class="img-rounded" src="<?= $v['id'] ?>" alt="Project#<?php echo $j ?>" style="width:100%; height:150px">
</a>
</div>
</div>
<?php $j++; endforeach; ?>
<?php $j++; } ?>
</div>
</div>
<?php $i++; endforeach; ?>
Expand Down

0 comments on commit 26faad4

Please sign in to comment.