var rowtypedata = [ [ [1,'', 'td25'], [1,'', 'td28'], [1,'', 'td25'], [1,'', 'td25'], [1,''], [1,''], [1,'', 'td23'] ] ]; EOF; foreach(C::t('home_click')->fetch_all_by_idtype($idtype) as $click) { $checkavailable = $click['available'] ? 'checked' : ''; $click['idtype'] = cplang('click_edit_'.$click['idtype']); showtablerow('', array('class="td25"', 'class="td28"', 'class="td25"', 'class="td25"', '', '', '', 'class="td23"', 'class="td25"'), array( "", "", "", "", "", "", $click['idtype'] )); } echo '
'.$lang['click_edit_addnew'].'
'; showsubmit('clicksubmit', 'submit', 'del'); showtablefooter(); showformfooter(); } else { $ids = array(); if(is_array($_GET['delete'])) { foreach($_GET['delete'] as $id) { $ids[] = $id; } if($ids) { C::t('home_click')->delete($ids, true); } } if(is_array($_GET['name'])) { foreach($_GET['name'] as $id => $val) { $id = intval($id); $updatearr = array( 'name' => dhtmlspecialchars($_GET['name'][$id]), 'icon' => $_GET['icon'][$id], 'idtype' => $idtype, 'available' => intval($_GET['available'][$id]), 'displayorder' => intval($_GET['displayorder'][$id]), ); C::t('home_click')->update($id, $updatearr); } } if(is_array($_GET['newname'])) { foreach($_GET['newname'] as $key => $value) { if($value != '' && $_GET['newicon'][$key] != '') { $data = array( 'name' => dhtmlspecialchars($value), 'icon' => $_GET['newicon'][$key], 'idtype' => $idtype, 'available' => intval($_GET['newavailable'][$key]), 'displayorder' => intval($_GET['newdisplayorder'][$key]) ); C::t('home_click')->insert($data); } } } $keys = $ids = $_G['cache']['click'] = array(); foreach(C::t('home_click')->fetch_all_by_available() as $value) { if(count($_G['cache']['click'][$value['idtype']]) < 8) { $keys[$value['idtype']] = $keys[$value['idtype']] ? ++$keys[$value['idtype']] : 1; $_G['cache']['click'][$value['idtype']][$keys[$value['idtype']]] = $value; } else { $ids[] = $value['clickid']; } } if($ids) { C::t('home_click')->update($ids, array('available'=>0), true); } updatecache('click'); cpmsg('click_edit_succeed', 'action=click&idtype='.$idtype, 'succeed'); } } ?>