'Html',
'Form',
'Javascript',
+ 'Selectpublic',
'Token'
);
}
}
+
+ /* public_flag設定をview用にセット */
+ function set_public_flag4view()
+ {
+ $model_public_flags = $this->get_public_flag();
+
+ $this->set('public_flags', $model_public_flags);
+ }
+ function get_public_flag()
+ {
+ return $this->{$this->modelClass}->public_flag;
+ }
}
// AppControllerを携帯とPCで振り分け
$systems = $this->Character->System->find('list');
$users = $this->Character->User->find('list');
$this->set(compact('systems', 'users'));
+
+ $this->set_public_flag4view();
}
function edit($id = null) {
$systems = $this->Character->System->find('list');
$users = $this->Character->User->find('list');
$this->set(compact('systems','users'));
+
+ $this->set_public_flag4view();
}
function delete($id = null) {
$this->Session->setFlash(__('The System could not be saved. Please, try again.', true));
}
}
+
+ $this->set_public_flag4view();
}
function admin_edit($id = null) {
$this->data['System'] = $this->_restore_html_system($this->data['System']);
}
+
+ $this->set_public_flag4view();
}
function admin_delete($id = null) {
$this->unsetData('auto', true);
// 認証なしアクセス可
- $this->AuthPlus->allow('login');
$this->AuthPlus->allow('add'); //todo:メール認証etc
$this->AuthPlus->allow('logout');
$this->AuthPlus->allow('to_login');
'label' => __('Status', true)
)
);
- echo $form->input('public_flag', array(
+ echo $selectpublic->create_publicflag_select($public_flags, 'public_flag', array(
'label' => __('Public Flag', true)
)
);
'label' => __('Status', true)
)
);
- echo $form->input('public_flag', array(
+ echo $selectpublic->create_publicflag_select($public_flags, 'public_flag', array(
'label' => __('Public Flag', true)
)
);
--- /dev/null
+<?php
+class SelectpublicHelper extends Helper {
+ var $helpers = array('Form');
+
+ var $default_public_flags = array('public_flag', 'private');
+ /**
+ * public_flagの選択プルダウン出力
+ * i18n対応
+ *
+ * @param array $public_flags
+ * @return String
+ */
+ function create_publicflag_select($public_flags = array(), $fieldName = 'public_flag', $options = array('type' => 'select')) {
+
+ if (empty($public_flags)) {
+ $public_flags = $this->default_public_flags;
+ }
+
+ if (!isset($options['type'])) {
+ $options['type'] = 'select';
+ }
+ if (!isset($options['options'])) {
+ $options['options'] = array();
+ }
+
+ foreach ($public_flags as $k => $v) {
+ if ($v == 'public') {
+ $options['options'][$v] = __('Public', true);
+ } elseif($v == 'private') {
+ $options['options'][$v] = __('Private', true);
+ } else {
+ $options['options'][$v] = $v;
+ }
+ }
+
+ return $this->Form->input($fieldName, $options);
+ }
+
+}
+
+
'selected' => true
)
);
- echo $form->input('public_flag', array(
- 'type' => 'select',
- 'label' => __('Public', true),
- 'options' => array(
- 'public' => __('Public', true),
- 'private' => __('Private', true),
- ),
+ echo $selectpublic->create_publicflag_select($public_flags, 'public_flag', array(
+ 'label' => __('Public Flag', true),
'selected' => 'public',
)
);
'selected' => true
)
);
- echo $form->input('public_flag', array(
- 'type' => 'select',
- 'label' => __('Public', true),
- 'options' => array(
- 'public' => __('Public', true),
- 'private' => __('Private', true),
- ),
- 'selected' => 'public',
+ echo $selectpublic->create_publicflag_select($public_flags, 'public_flag', array(
+ 'label' => __('Public Flag', true)
)
);
echo $form->input('detail', array(