'.$lang['display_order'].''.$lang['faq_thread'].''; $faqparent = $faqsub = array(); $faqlists = $faqselect = ''; foreach(C::t('forum_faq')->fetch_all_by_fpid() as $faq) { if(empty($faq['fpid'])) { $faqparent[$faq['id']] = $faq; $faqselect .= ""; } else { $faqsub[$faq['fpid']][] = $faq; } } foreach($faqparent as $parent) { $disabled = !empty($faqsub[$parent['id']]) ? 'disabled' : ''; showtablerow('', array('', 'class="td23 td28"'), array( "", "", "
", "".$lang['detail']."" )); if(!empty($faqsub[$parent['id']])) { foreach($faqsub[$parent['id']] as $sub) { showtablerow('', array('', 'class="td23 td28"'), array( "", "", "
", "".$lang['detail']."" )); } } echo '
'.cplang('faq_additem').'
'; } echo '
'.cplang('faq_addcat').'
'; echo << var rowtypedata = [ [[1,''], [1,'', 'td25'], [1, ''], [1, '']], [[1,''], [1,'', 'td25'], [1, '
'], [1, '']] ]; EOT; showsubmit('faqsubmit', 'submit', 'del'); showtablefooter(); showformfooter(); } else { if($_GET['delete']) { C::t('forum_faq')->delete($_GET['delete']); } if(is_array($_GET['title'])) { foreach($_GET['title'] as $id => $val) { C::t('forum_faq')->update($id, array( 'displayorder' => $_GET['displayorder'][$id], 'title' => $_GET['title'][$id] )); } } if(is_array($_GET['newtitle'])) { foreach($_GET['newtitle'] as $k => $v) { $v = trim($v); if($v) { C::t('forum_faq')->insert(array( 'fpid' => intval($_GET['newfpid'][$k]), 'displayorder' => intval($_GET['newdisplayorder'][$k]), 'title' => $v )); } } } cpmsg('faq_list_update', 'action=faq&operation=list', 'succeed'); } } elseif($operation == 'detail') { $id = $_GET['id']; if(!submitcheck('detailsubmit')) { $faq = C::t('forum_faq')->fetch($id); if(!$faq) { cpmsg('faq_nonexistence', '', 'error'); } foreach(C::t('forum_faq')->fetch_all_by_fpid(0) as $parent) { $faqselect .= ""; } shownav('extended', 'faq'); showsubmenu('faq'); showformheader("faq&operation=detail&id=$id"); showtableheader(); showtitle('faq_edit'); showsetting('faq_title', 'titlenew', $faq['title'], 'text'); if(!empty($faq['fpid'])) { showsetting('faq_sortup', '', '', ''); showsetting('faq_identifier', 'identifiernew', $faq['identifier'], 'text'); showsetting('faq_keywords', 'keywordnew', $faq['keyword'], 'text'); showsetting('faq_content', 'messagenew', $faq['message'], 'textarea'); } showsubmit('detailsubmit'); showtablefooter(); showformfooter(); } else { if(!$_GET['titlenew']) { cpmsg('faq_no_title', '', 'error'); } if(!empty($_GET['identifiernew'])) { if(C::t('forum_faq')->check_identifier($_GET['identifiernew'], $id)) { cpmsg('faq_identifier_invalid', '', 'error'); } } if(strlen($_GET['keywordnew']) > 50) { cpmsg('faq_keyword_toolong', '', 'error'); } $fpidnew = $_GET['fpidnew'] ? intval($_GET['fpidnew']) : 0; $titlenew = trim($_GET['titlenew']); $messagenew = trim($_GET['messagenew']); $identifiernew = trim($_GET['identifiernew']); $keywordnew = trim($_GET['keywordnew']); C::t('forum_faq')->update($id, array( 'fpid' => $fpidnew, 'identifier' => $identifiernew, 'keyword' => $keywordnew, 'title' => $titlenew, 'message' => $messagenew, )); cpmsg('faq_list_update', 'action=faq&operation=list', 'succeed'); } } ?>