Skip to content

Commit

Permalink
Merge pull request #105 from s-nakajima/master
Browse files Browse the repository at this point in the history
バグ修正
  • Loading branch information
s-nakajima committed Nov 24, 2016
2 parents 03b38b8 + b5a7ea0 commit 6c6c704
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 163 deletions.
2 changes: 1 addition & 1 deletion Model/BbsArticle.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public function __construct($id = false, $table = null, $ds = null) {
$this->bindModel(array(
'belongsTo' => array(
'BbsArticleTree' => array(
'type' => 'INNER',
'type' => 'LEFT',
'className' => 'Bbses.BbsArticleTree',
'foreignKey' => false,
'conditions' => array(
Expand Down
162 changes: 0 additions & 162 deletions View/Helper/BbsesFormHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,166 +92,4 @@ public function replyEditButtons($statusFieldName) {
return $output;
}

/**
* Output workflow input comment
*
* @param string $statusFieldName ステータスのフィールド名
* @param bool $displayBlockKey block_keyを含めるかどうか
* @return string Html
* @SuppressWarnings(PHPMD.BooleanArgumentFlag)
*/
public function inputComment($statusFieldName, $displayBlockKey = true) {
$status = Hash::get($this->_View->data, $statusFieldName);

$output = $this->_View->element('Workflow.form', array(
'contentPublishable' => Current::permission('content_publishable'),
'contentStatus' => $status,
));

if ($displayBlockKey) {
$output .= $this->NetCommonsForm->hidden('Block.key', ['value' => Current::read('Block.key')]);
}
return $output;
}

/**
* Output workflow input comment
*
* @return string Cancel url
*/
public function comments() {
if (! isset($this->_View->viewVars['comments'])) {
$this->_View->viewVars['comments'] = array();
}

return $this->_View->element('Workflow.index', array(
'comments' => $this->_View->viewVars['comments']
));
}

/**
* Check editable permission
*
* @param string $model This should be "Pluginname.Modelname"
* @param array $data Model data
* @return bool True is editable data
*/
public function canEdit($model, $data) {
list($plugin, $model) = pluginSplit($model);
if (! $plugin) {
$plugin = Inflector::pluralize(Inflector::classify($this->request->params['plugin']));
}
${$model} = ClassRegistry::init($plugin . '.' . $model);

return ${$model}->canEditWorkflowContent($data);
}

/**
* Check deletable permission
*
* @param string $model This should be "Pluginname.Modelname"
* @param array $data Model data
* @return bool True is editable data
*/
public function canDelete($model, $data) {
list($plugin, $model) = pluginSplit($model);
if (! $plugin) {
$plugin = Inflector::pluralize(Inflector::classify($this->request->params['plugin']));
}
${$model} = ClassRegistry::init($plugin . '.' . $model);

return ${$model}->canDeleteWorkflowContent($data);
}

/**
* Creates a `<a>` tag for publish link link. The type attribute defaults
*
* @param string $title The button's caption. Not automatically HTML encoded
* @param array $options Array of options and HTML attributes.
* @return string A HTML button tag.
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#FormHelper::button
*/
public function publishLinkButton($title = '', $options = array()) {
$output = '';

//ボタンサイズ
$sizeAttr = Hash::get($options, 'iconSize', '');
if ($sizeAttr) {
$sizeAttr = ' ' . $sizeAttr;
}
$options = Hash::remove($options, 'iconSize');

//Linkオプションの設定
$inputOptions = Hash::merge(
array(
'icon' => 'ok',
'name' => 'save_' . WorkflowComponent::STATUS_PUBLISHED,
'class' => 'btn btn-warning' . $sizeAttr
),
$options,
array(
'escapeTitle' => false,
)
);
if (Hash::get($options, 'escapeTitle', true)) {
$title = h($title);
}

//iconの有無
$iconElement = '<span class="glyphicon glyphicon-' . h($inputOptions['icon']) . '"></span> ';
unset($options['icon']);

//span tooltipタグの出力
if (isset($options['tooltip']) && $options['tooltip']) {
if (is_string($options['tooltip'])) {
$tooltip = $options['tooltip'];
} else {
$tooltip = __d('net_commons', 'Accept');
}
$output .= '<span class="nc-tooltip" tooltip="' . $tooltip . '">';
unset($inputOptions['tooltip']);
}
$output .= $this->Form->button($iconElement . $title, $inputOptions);
if (isset($options['tooltip']) && $options['tooltip']) {
$output .= '</span>';
}
return $output;
}

/**
* Creates a `<a>` tag for add link. The type attribute defaults
*
* @param string $title The button's caption. Not automatically HTML encoded
* @param mixed $url Link url
* @param array $options Array of options and HTML attributes.
* @return string A HTML button tag.
*/
public function addLinkButton($title = '', $url = null, $options = array()) {
$output = '';

if (! Current::permission('content_creatable')) {
return $output;
}

//URLの設定
$defaultUrl = array(
'plugin' => $this->_View->request->params['plugin'],
'controller' => $this->_View->request->params['controller'],
);
if (! isset($url)) {
$url = array(
'action' => 'add',
'block_id' => Current::read('Block.id'),
'frame_id' => Current::read('Frame.id'),
);
if (isset($this->_View->viewVars['addActionController'])) {
$url['controller'] = $this->_View->viewVars['addActionController'];
}
}
$url = Hash::merge($defaultUrl, $url);

$output = $this->LinkButton->add($title, $url, $options);
return $output;
}

}

0 comments on commit 6c6c704

Please sign in to comment.