}
function __restore_html_profile($data) {
if (isset($data['ProfileSelect']) && !empty($data['ProfileSelect'])) {
- $data = $this->_restore_html_profile_select($data);
+ $data['ProfileSelect'] = $this->_restore_html_profile_select($data['ProfileSelect']);
}
if (isset($data['ProfileTable']) && !empty($data['ProfileTable'])) {
- $data = $this->_restore_html_profile_table($data);
+ $data['ProfileTable'] = $this->_restore_html_profile_table($data['ProfileTable']);
}
if (isset($data['ProfileTableStatic']) && !empty($data['ProfileTableStatic'])) {
- $data = $this->_restore_html_profile_table_static($data);
+ $data['ProfileTableStatic'] = $this->_restore_html_profile_table_static($data['ProfileTableStatic']);
}
return $data;
}
function _restore_html_profile_select($data) {
- foreach ($data['ProfileSelect'] as $k => $v) {
- if (isset($data['ProfileSelect'][$k]['value']) && !empty($data['ProfileSelect'][$k]['value'])) {
- $data['ProfileSelect'][$k]['value'] = $this->{$this->modelClass}->restore_html($v['value'], false, false, false);
+ $sort_order = array();
+ foreach ($data as $k => $v) {
+ if (isset($v['value']) && !empty($v['value'])) {
+ $data[$k]['value'] = $this->{$this->modelClass}->restore_html($v['value'], false, false, false);
+ }
+
+ if (isset($v['sort_order']) && !empty($v['sort_order'])) {
+ $sort_order[$k] = $v['sort_order'];
+ } else {
+ $sort_order[$k] = 0;
}
}
+ $data = $this->sort4sort_order($data, $sort_order);
+
return $data;
}
function _restore_html_profile_table($data) {
- foreach ($data['ProfileTable'] as $k => $v) {
- if (isset($data['ProfileTable'][$k]['value']) && !empty($data['ProfileTable'][$k]['value'])) {
- $data['ProfileTable'][$k]['value'] = $this->{$this->modelClass}->restore_html($v['value'], false, false, false);
+ foreach ($data as $k => $v) {
+ if (isset($v['value']) && !empty($v['value'])) {
+ $data[$k]['value'] = $this->{$this->modelClass}->restore_html($v['value'], false, false, false);
+ }
+
+ if (isset($v['sort_order']) && !empty($v['sort_order'])) {
+ $sort_order[$k] = $v['sort_order'];
+ } else {
+ $sort_order[$k] = 0;
}
}
+ $data = $this->sort4sort_order($data, $sort_order);
+
return $data;
}
function _restore_html_profile_table_static($data) {
- foreach ($data['ProfileTableStatic'] as $k => $v) {
- if (isset($data['ProfileTableStatic'][$k]['title']) && !empty($data['ProfileTableStatic'][$k]['title'])) {
+ foreach ($data as $k => $v) {
+ if (isset($v['title']) && !empty($v['title'])) {
$data['ProfileTableStatic'][$k]['title'] = $this->{$this->modelClass}->restore_html($v['title'], false, false, false);
}
+
+ if (isset($v['sort_order']) && !empty($v['sort_order'])) {
+ $sort_order[$k] = $v['sort_order'];
+ } else {
+ $sort_order[$k] = 0;
+ }
+ }
+
+ $data = $this->sort4sort_order($data, $sort_order);
+
+ return $data;
+ }
+
+ function sort4sort_order($data, $sort_order)
+ {
+ if (empty($data) || empty($sort_order)) {
+ return $data;
}
+ array_multisort($sort_order, SORT_ASC, $data);
return $data;
}
$this->Character->System->Profile->hasMany['CharactersHasProfile']['fields'] = '';
unset($this->Character->hasMany['CharacterProfileArchive']);
- $character = $this->_get_character($id, array(), false, array('System' => 'Ptofile'));
+ $character = $this->_get_character($id, array(), false);
if (!$this->isOwner($character['Character'], $this->user_id)) {
$this->Session->setFlash(__('No Permission', true));
$this->redirect(array('action'=>'index'));
$this->Character->System->Profile->hasMany['CharactersHasProfile']['fields'] = '';
unset($this->Character->hasMany['CharacterProfileArchive']);
- $character = $this->_get_character($id, array(), true, array('System' => 'Profile'));
+ $character = $this->_get_character($id, array(), true);
if (!$character) {
$this->Session->setFlash(__('No Character', true));
$this->redirect(array('action'=>'index'));
function admin_listview($profile_id = null) {
- $profile = $this->get_profile4profile_id ($profile_id);
+ $profile = $this->get_profile4profile_id($profile_id);
$this->set('profile', $profile);
}
));
if ($this->check_profile_type($profile)) {
+
+ foreach ($profile['ProfileSelect'] as $k => $v) {
+
+ if (isset($v['sort_order']) && !empty($v['sort_order'])) {
+ $sort_order[$k] = $v['sort_order'];
+ } else {
+ $sort_order[$k] = 0;
+ }
+ }
+ $profile['ProfileSelect'] = $this->sort4sort_order($profile['ProfileSelect'], $sort_order);
+
return $profile;
}
}
$this->redirect(array('controller'=>'systems', 'action'=>'admin_index'));
}
+ foreach ($profileTable['ProfileTableStatic'] as $k => $v) {
+ if (isset($v['sort_order']) && !empty($v['sort_order'])) {
+ $sort_order[$k] = $v['sort_order'];
+ } else {
+ $sort_order[$k] = 0;
+ }
+ }
+ $profileTable['ProfileTableStatic'] = $this->sort4sort_order($profileTable['ProfileTableStatic'], $sort_order);
+
if (!empty($this->data)) {
// POSTデータ処理
$this->_set_new_profile_table_static($profileTable['ProfileTable']['id']);
continue;
}
- $this->data['ProfileTableStatic'][$k]['profile_table_id'] = $profile_table_id;
+ $this->data['ProfileTableStatic'][$k]['profile_table_id'] = $profile_table_id;
- if (empty($v['sort_order'])) {
- $this->data['ProfileTableStatic'][$k]['sort_order'] = 0;
- }
+ if (empty($v['sort_order'])) {
+ $this->data['ProfileTableStatic'][$k]['sort_order'] = 0;
+ }
}
unset($this->data['ProfileTableStatic']['__Token']);
));
if ($this->check_profile_type($profile)) {
+ foreach ($profile['ProfileTable'] as $k => $v) {
+
+ if (isset($v['sort_order']) && !empty($v['sort_order'])) {
+ $sort_order[$k] = $v['sort_order'];
+ } else {
+ $sort_order[$k] = 0;
+ }
+ }
+ $profile['ProfileTable'] = $this->sort4sort_order($profile['ProfileTable'], $sort_order);
+
return $profile;
}
}
'SiteConfig.value',
),
'recursive' => -1,
- 'order' => array('SiteConfig.key_name' => 'asc'),
+// 'order' => array('SiteConfig.key_name' => 'asc'), // MySQL Filesortの原因
));
$site_configs = array();
'dependent' => true,
'conditions' => '',
'fields' => '',
- 'order' => array('ProfileSelect.sort_order' => 'asc'),
+// 'order' => array('ProfileSelect.sort_order' => 'asc'), // Using filesortの原因
'limit' => '',
'offset' => '',
'exclusive' => '',
'dependent' => true,
'conditions' => '',
'fields' => '',
- 'order' => array('ProfileTable.sort_order' => 'asc'),
+// 'order' => array('ProfileTable.sort_order' => 'asc'),
'limit' => '',
'offset' => '',
'exclusive' => '',
'dependent' => true,
'conditions' => '',
'fields' => '',
- 'order' => array('ProfileTableStatic.sort_order' => 'asc'),
+// 'order' => array('ProfileTableStatic.sort_order' => 'asc'),
'limit' => '',
'offset' => '',
'finderQuery' => '',
'Profile.key_name',
'Profile.profile_type',
),
- 'order' => 'Profile.sort_order ASC',
+// 'order' => 'Profile.sort_order ASC',
),
// システムイメージ
'Attachment' => array(