Skip to content

Commit 9d70bf7

Browse files
committed
updated files
0 parents  commit 9d70bf7

File tree

176 files changed

+20383
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

176 files changed

+20383
-0
lines changed

Block/Adminhtml/Designer.php

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
/**
3+
* Landofcoder
4+
*
5+
* NOTICE OF LICENSE
6+
*
7+
* This source file is subject to the Landofcoder.com license that is
8+
* available through the world-wide-web at this URL:
9+
* http://www.landofcoder.com/license-agreement.html
10+
*
11+
* DISCLAIMER
12+
*
13+
* Do not edit or add to this file if you wish to upgrade this extension to newer
14+
* version in the future.
15+
*
16+
* @category Landofcoder
17+
* @package Lof_Designer
18+
* @copyright Copyright (c) 2014 Landofcoder (http://www.landofcoder.com/)
19+
* @license http://www.landofcoder.com/LICENSE-1.0.html
20+
*/
21+
namespace Lof\Designer\Block\Adminhtml;
22+
23+
/**
24+
* Adminhtml cms pages content block
25+
*/
26+
class Designer extends \Magento\Backend\Block\Widget\Grid\Container
27+
{
28+
/**
29+
* Block constructor
30+
*
31+
* @return void
32+
*/
33+
protected function _construct()
34+
{
35+
$this->_controller = 'adminhtml_designer';
36+
$this->_blockGroup = 'Lof_Designer';
37+
$this->_headerText = __('Manage Designers');
38+
39+
parent::_construct();
40+
41+
if ($this->_isAllowedAction('Lof_Designer::designer_save')) {
42+
$this->buttonList->update('add', 'label', __('Add New Designer'));
43+
} else {
44+
$this->buttonList->remove('add');
45+
}
46+
}
47+
48+
/**
49+
* Check permission for passed action
50+
*
51+
* @param string $resourceId
52+
* @return bool
53+
*/
54+
protected function _isAllowedAction($resourceId)
55+
{
56+
return $this->_authorization->isAllowed($resourceId);
57+
}
58+
}

Block/Adminhtml/Designer/Edit.php

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
<?php
2+
/**
3+
* Landofcoder
4+
*
5+
* NOTICE OF LICENSE
6+
*
7+
* This source file is subject to the Landofcoder.com license that is
8+
* available through the world-wide-web at this URL:
9+
* http://www.landofcoder.com/license-agreement.html
10+
*
11+
* DISCLAIMER
12+
*
13+
* Do not edit or add to this file if you wish to upgrade this extension to newer
14+
* version in the future.
15+
*
16+
* @category Landofcoder
17+
* @package Lof_Designer
18+
* @copyright Copyright (c) 2014 Landofcoder (http://www.landofcoder.com/)
19+
* @license http://www.landofcoder.com/LICENSE-1.0.html
20+
*/
21+
namespace Lof\Designer\Block\Adminhtml\Designer;
22+
23+
/**
24+
* Designer edit block
25+
*/
26+
class Edit extends \Magento\Backend\Block\Widget\Form\Container
27+
{
28+
/**
29+
* Core registry
30+
*
31+
* @var \Magento\Framework\Registry
32+
*/
33+
protected $_coreRegistry = null;
34+
35+
/**
36+
* @param \Magento\Backend\Block\Widget\Context $context
37+
* @param \Magento\Framework\Registry $registry
38+
* @param array $data
39+
*/
40+
public function __construct(
41+
\Magento\Backend\Block\Widget\Context $context,
42+
\Magento\Framework\Registry $registry,
43+
array $data = []
44+
) {
45+
$this->_coreRegistry = $registry;
46+
parent::__construct($context, $data);
47+
}
48+
49+
/**
50+
* Initialize designer edit block
51+
*
52+
* @return void
53+
*/
54+
protected function _construct(){
55+
$this->_objectId = 'designer_id';
56+
$this->_blockGroup = 'Lof_Designer';
57+
$this->_controller = 'adminhtml_designer';
58+
59+
parent::_construct();
60+
61+
if($this->_isAllowedAction('Lof_Designer::designer_save')){
62+
$this->buttonList->update('save','label',__('Save Designer'));
63+
$this->buttonList->add(
64+
'saveandcontinue',
65+
[
66+
'label' => __('Save and Continue Edit'),
67+
'class' => 'save',
68+
'data_attribute' => [
69+
'mage-init' => [
70+
'button' => ['event' => 'saveAndContinueEdit', 'target' => '#edit_form'],
71+
],
72+
]
73+
],
74+
-100
75+
);
76+
}else{
77+
$this->buttonList->remove('save');
78+
}
79+
80+
if ($this->_isAllowedAction('Lof_Designer::designer_delete')) {
81+
$this->buttonList->update('delete', 'label', __('Delete Designer'));
82+
} else {
83+
$this->buttonList->remove('delete');
84+
}
85+
}
86+
87+
/**
88+
* Retrieve text for header element depending on loaded page
89+
*
90+
* @return \Magento\Framework\Phrase
91+
*/
92+
public function getHeaderText()
93+
{
94+
if ($this->_coreRegistry->registry('lof_designer')->getId()) {
95+
return __("Edit Designer '%1'", $this->escapeHtml($this->_coreRegistry->registry('lof_designer')->getName()));
96+
} else {
97+
return __('New Designer');
98+
}
99+
}
100+
101+
/**
102+
* Check permission for passed action
103+
*
104+
* @param string $resourceId
105+
* @return bool
106+
*/
107+
protected function _isAllowedAction($resourceId)
108+
{
109+
return $this->_authorization->isAllowed($resourceId);
110+
}
111+
112+
/**
113+
* Getter of url for "Save and Continue" button
114+
* tab_id will be replaced by desired by JS later
115+
*
116+
* @return string
117+
*/
118+
protected function _getSaveAndContinueUrl()
119+
{
120+
return $this->getUrl('cms/*/save', ['_current' => true, 'back' => 'edit', 'active_tab' => '{{tab_id}}']);
121+
}
122+
123+
/**
124+
* Prepare layout
125+
*
126+
* @return \Magento\Framework\View\Element\AbstractBlock
127+
*/
128+
protected function _prepareLayout()
129+
{
130+
$this->_formScripts[] = "
131+
function toggleEditor() {
132+
if (tinyMCE.getInstanceById('page_content') == null) {
133+
tinyMCE.execCommand('mceAddControl', false, 'page_content');
134+
} else {
135+
tinyMCE.execCommand('mceRemoveControl', false, 'page_content');
136+
}
137+
};
138+
";
139+
return parent::_prepareLayout();
140+
}
141+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
/**
3+
* Landofcoder
4+
*
5+
* NOTICE OF LICENSE
6+
*
7+
* This source file is subject to the Landofcoder.com license that is
8+
* available through the world-wide-web at this URL:
9+
* http://www.landofcoder.com/license-agreement.html
10+
*
11+
* DISCLAIMER
12+
*
13+
* Do not edit or add to this file if you wish to upgrade this extension to newer
14+
* version in the future.
15+
*
16+
* @category Landofcoder
17+
* @package Lof_Designer
18+
* @copyright Copyright (c) 2014 Landofcoder (http://www.landofcoder.com/)
19+
* @license http://www.landofcoder.com/LICENSE-1.0.html
20+
*/
21+
namespace Lof\Designer\Block\Adminhtml\Designer\Edit;
22+
23+
/**
24+
* Adminhtml cms page edit form block
25+
*
26+
* @author Magento Core Team <[email protected]>
27+
*/
28+
class Form extends \Magento\Backend\Block\Widget\Form\Generic
29+
{
30+
/**
31+
* Prepare form
32+
*
33+
* @return $this
34+
*/
35+
protected function _prepareForm()
36+
{
37+
/** @var \Magento\Framework\Data\Form $form */
38+
$form = $this->_formFactory->create(
39+
[
40+
'data' => [
41+
'id' => 'edit_form',
42+
'action' => $this->getData('action'),
43+
'method' => 'post',
44+
'enctype' => 'multipart/form-data'
45+
]
46+
]
47+
);
48+
$form->setUseContainer(true);
49+
$this->setForm($form);
50+
return parent::_prepareForm();
51+
}
52+
}

0 commit comments

Comments
 (0)