<div id="selEditLinks">
	<h2 class="clsQuestionCategory">{$myobj->questionCategoryCommon.title}</h2>
	<div class="clsSubLink">

{include file='information.tpl'}

		{if  $myobj->isShowPageBlock('form_add_category')}
			<div id="selEditLinks">
				<form name="formAddCategory" id="formAddCategory" method="post" action="{$myobj->getCurrentUrl(true)}" autocomplete="off">
				<table class="clsCommonTable" summary="{$LANG.category_add_tbl_summary}">
				   <tr>
						<td class="{$myobj->getCSSFormLabelCellClass('category')}"><label for="category">{$LANG.category_name}</label>&nbsp;*&nbsp;</td>
						<td class="{$myobj->getCSSFormFieldCellClass('category')}"><input type="text" class="clsTextBox {$myobj->getCSSFormFieldElementClass('category')}" name="category" id="category" tabindex="{smartyTabIndex}" value="{$myobj->getFormField('category')}" maxlength="60" />{$myobj->getFormFieldElementErrorTip('category')}</td>
				   </tr>
				   <tr>
						<td class="{$myobj->getCSSFormLabelCellClass('status')}"><label for="status_active">{$LANG.common_status}</label></td>
						<td class="{$myobj->getCSSFormFieldCellClass('status')}">
							<input type="radio" name="status" id="status_active" value="1" tabindex="{smartyTabIndex}" { if $myobj->getFormField('status') eq '1'} CHECKED {/if} />&nbsp;<label for="status_active">{$LANG.common_display_active}</label>
							&nbsp;&nbsp;
							<input type="radio" name="status" id="status_inactive" value="0" tabindex="{smartyTabIndex}" { if $myobj->getFormField('status') eq '0'} CHECKED {/if} />&nbsp;<label for="status_inactive">{$LANG.common_display_inactive}</label>{$myobj->getFormFieldElementErrorTip('status')}
						</td>
				   </tr>
				   <tr>
				   		<td class="{$myobj->getCSSFormLabelCellClass('submit')}"></td>
						<td class="{$myobj->getCSSFormFieldCellClass('submit')}">
							<input type="submit" class="clsSubmitButton clsMediumSubmitButton" name="add_category" id="add_category" tabindex="{smartyTabIndex}" value="{if  $myobj->getFormField('cat_id')} {$LANG.category_update} {else} {$LANG.category_add} {/if}" />&nbsp;
							{if  $myobj->getFormField('cat_id')}
								<input type="submit" class="clsCancelButton" name="cancel" id="cancel" tabindex="{smartyTabIndex}" value="{$LANG.common_cancel}" />
							{/if}
						</td>
				   </tr>
				</table>
				{$myobj->populateHiddenFormFields($myobj->form_add_category.hidden_array)}
				</form>
			</div>
     		{literal}
				<script language="javascript" type="text/javascript">
                    needLiveValidation('category',Array('Presence'))
                </script>
          	{/literal}
		{/if}
		{if  $myobj->isShowPageBlock('form_add_sub_category')}
			<div id="selEditLinks">
				<form name="formAddCategory" id="formAddCategory" method="post" action="{$myobj->getCurrentUrl(true)}" autocomplete="off">
				<table class="clsCommonTable" summary="{$LANG.category_add_tbl_summary}">
				   <tr>
						<td class="{$myobj->getCSSFormLabelCellClass('parent_id')}"><label for="parent_id">{$LANG.category_name}</label>&nbsp;*&nbsp;</td>
						<td class="{$myobj->getCSSFormFieldCellClass('parent_id')}">
						<select name="parent_id" id="parent_id" class="{$myobj->getCSSFormFieldElementClass('parent_id')}" tabindex="{smartyTabIndex}">
							<option value="">{$LANG.common_select_choose}</option>
							{foreach key=inc item=value from=$myobj->form_add_sub_category.populateCategories}
								<option value="{$value.record.cat_id}" {$value.selected_chk} >{$value.record.cat_name}</option>
							{/foreach}
						</select>{$myobj->getFormFieldElementErrorTip('parent_id')}</td>
				   </tr>
				   <tr>
						<td class="{$myobj->getCSSFormLabelCellClass('category')}"><label for="category">{$LANG.category_sub_name}</label>&nbsp;*&nbsp;</td>
						<td class="{$myobj->getCSSFormFieldCellClass('category')}"><input type="text" class="clsTextBox {$myobj->getCSSFormFieldElementClass('category')}" name="category" id="category" tabindex="{smartyTabIndex}" value="{$myobj->getFormField('category')}" maxlength="60" />{$myobj->getFormFieldElementErrorTip('category')}</td>
				   </tr>
				   <tr>
						<td class="{$myobj->getCSSFormLabelCellClass('status')}"><label for="status_active">{$LANG.common_status}</label></td>
						<td class="{$myobj->getCSSFormFieldCellClass('status')}">
							<input type="radio" name="status" id="status_active" value="1" tabindex="{smartyTabIndex}" {if $myobj->getFormField('status') eq '1'} CHECKED {/if} />&nbsp;<label for="status_active">{$LANG.common_display_active}</label>
							&nbsp;&nbsp;
							<input type="radio" name="status" id="status_inactive" value="0" tabindex="{smartyTabIndex}" {if $myobj->getFormField('status') eq '0' } CHECKED {/if} />&nbsp;<label for="status_inactive">{$LANG.common_display_inactive}</label>{$myobj->getFormFieldElementErrorTip('status')}
						</td>
				   </tr>
				   <tr>
						<td class="{$myobj->getCSSFormLabelCellClass('submit')}"></td>
						<td class="{$myobj->getCSSFormFieldCellClass('submit')}">
							<input type="submit" class="clsSubmitButton clsMediumSubmitButton" name="add_sub_category" id="add_sub_category" tabindex="{smartyTabIndex}" value="{if  $myobj->getFormField('sub_cat_id')} {$LANG.category_update_sub} {else} {$LANG.category_add_sub} {/if}" />&nbsp;
							{if  $myobj->getFormField('sub_cat_id')}
								<input type="submit" class="clsCancelButton" name="cancel" id="cancel" tabindex="{smartyTabIndex}" value="{$LANG.common_cancel}" />
							{/if}
						</td>
				   </tr>
				</table>
				{$myobj->populateHiddenFormFields($myobj->form_add_sub_category.hidden_array)}
				</form>
			</div>
			{literal}
               	<script language="javascript" type="text/javascript">
               		needLiveValidation('parent_id',Array('Presence'));
               		needLiveValidation('category',Array('Presence'));
               	</script>
          	{/literal}
		{/if}
		{if  $myobj->isShowPageBlock('form_view_category')}
			<!-- Confirmation Div -->
			<div id="selMsgConfirm" class="selMsgConfirm" style="display:none;position:absolute;">
				<form name="formConfirm" id="formConfirm" method="post" action="questionCategory.php" autocomplete="off">
				<p id="confirmMessage"></p>
				<table class="clsCommonTable" summary="{$LANG.category_confirm_tbl_summary}">
					<tr>
						<td>
							<input type="submit" class="clsSubmitButton" name="confirm_action" id="confirm_action" value="{$LANG.common_confirm}" tabindex="{smartyTabIndex}" /> &nbsp;
							<input type="button" class="clsCancelButton" name="cancel" id="cancel" value="{$LANG.common_cancel}" tabindex="{smartyTabIndex}" onClick="return hideAllBlocks('formViewCategory');" />
							<input type="hidden" name="cat_ids" />
							<input type="hidden" name="action" />
						</td>
					</tr>
				</table>
				{$myobj->populateHiddenFormFields($myobj->form_view_category.hidden_array)}
				</form>
			</div>

			<div id="selViewLinks">
				<form name="formViewCategory" id="formViewCategory" method="post" action="{$myobj->getCurrentUrl(true)}" autocomplete="off">
					{if !$myobj->form_view_category.showCategory.RecordCount}
						<div id="selMsgAlert">
								<p>{$LANG.common_no_records_found}</p>
						</div>
					{else}
						{if $CFG.admin.navigation.top}
							{include file='pagination.tpl'}
						{/if}
						<table class="clsCommonTable" cellpadding="0" summary="{$LANG.category_view_tbl_summary}">
						<tr>
							<th>&nbsp;<input type="checkbox" name="checkall" id="checkall" tabindex="{smartyTabIndex}" onclick="selectAll(this.form)"/></th>
							<th class="clsQuestions{$myobj->getOrderCss('cat_name')}"><a href="#" onclick="return changeOrderbyElements('formViewCategory','cat_name')">{$LANG.category_name}</a></th>
							<th>{$LANG.category_sub_category_count}</th>
							<th class="clsQuestions{$myobj->getOrderCss('total_questions')}"><a href="#" onclick="return changeOrderbyElements('formViewCategory','total_questions')">{$LANG.category_question_count}</a></th>
							{if $CFG.admin.module.debate}
								<th class="clsQuestions{$myobj->getOrderCss('total_debates')}"><a href="#" onclick="return changeOrderbyElements('formViewCategory','total_debates')">{$LANG.category_debate_count}</a></th>
							{/if}
							<th class="clsQuestions{$myobj->getOrderCss('status')}"> <a href="#" onclick="return changeOrderbyElements('formViewCategory','status')">{$LANG.common_status}</a></th>
							<th class="clsQuestions{$myobj->getOrderCss('date_added')}"><a href="#" onclick="return changeOrderbyElements('formViewCategory','date_added')">{$LANG.common_date_added}</a></th>
							<th>{$LANG.common_manage}</th>
						</tr>
						{foreach key=inc item=value from=$myobj->form_view_category.showCategory.row}
							<tr>
								<td>
									<input type="checkbox" name="cat_ids[]" value="{$value.record.cat_id}" onClick="disableHeading('formViewCategory');" tabindex="{smartyTabIndex}" />
								</td>
								<td>{$value.record.cat_name}</td>
								<td><a href="{$value.questionCategory_mode_url}">{$myobj->countSubCategory($value.record.cat_id)}</a></td>
								<td>{$value.record.total_questions}</td>
								{if $CFG.admin.module.debate}
									<td>{$value.record.total_debates}</td>
								{/if}
								<td>{$value.record.status}</td>
								<td>{$value.record.date_added}</td>
								<td class="clsEditGroupLinks"><a class="clsEditGroupLink" href="{$value.questionCategory_url}">{$LANG.common_edit}</a></td>
							</tr>
						{/foreach}

						<tr>
							<td colspan="7"  class="clsButtonAlignment {$myobj->getCSSFormFieldCellClass('action')}">
								<select name="action" id="action" tabindex="{smartyTabIndex}" >
								{foreach key=inc item=value from=$myobj->form_view_category.showCategory.populateFilterList}
									<option value="{$value.key}" {$value.selected_chk}>{$value.name}</option>
								{/foreach}
								</select>
								<a href="#" id="dAltMlti"></a>
								<input type="button" class="clsSubmitButton" name="category_action" id="category_action" onclick="getMultiCheckBoxValue('formViewCategory', 'checkall', '{$LANG.category_err_tip_select_category}');if(multiCheckValue!='') getAction()" value="{$LANG.common_submit}" tabindex="{smartyTabIndex}" />
							</td>
						</tr>
					</table>
				{/if}
				{$myobj->populateHidden($myobj->form_view_category.hidden_array)}
				{if $CFG.admin.navigation.bottom}
	   				 	{include file='pagination.tpl'}
   	 			{/if}
			</form>
		</div>

	{/if}

	{if  $myobj->isShowPageBlock('form_view_sub_category')}
		<!-- Confirmation Div -->
		<div id="selMsgConfirm" class="selMsgConfirm" style="display:none;position:absolute;">
			<form name="formConfirm" id="formConfirm" method="post" action="questionCategory.php?cat_id={$myobj->getFormField('cat_id')}" autocomplete="off">
			<p id="confirmMessage"></p>
			<table class="clsCommonTable" summary="{$LANG.category_confirm_tbl_summary}">
				<tr>
					<td>
						<input type="submit" class="clsSubmitButton" name="confirm_action" id="confirm_action" value="{$LANG.common_confirm}" tabindex="{smartyTabIndex}" /> &nbsp;
						<input type="button" class="clsSubmitButton" name="cancel" id="cancel" value="{$LANG.common_cancel}" tabindex="{smartyTabIndex}" onClick="return hideAllBlocks('formViewCategory');" />
						<input type="hidden" name="cat_ids" />
						<input type="hidden" name="action" />
					</td>
				</tr>
			</table>
			{$myobj->populateHiddenFormFields($myobj->form_view_sub_category.hidden_array)}
			</form>
		</div>
		<div id="selViewLinks">
		<form name="formViewCategory" id="formViewCategory" method="post" action="{$myobj->getCurrentUrl(true)}" autocomplete="off">
			<h3>{$LANG.category_name} : {$myobj->showCategoryName($myobj->getFormField('cat_id'))}</h3>
			{if !$myobj->form_view_sub_category.showSubCategory.RecordCount}
				<div id="selMsgAlert">
					<p>{$LANG.common_no_records_found}</p>
				</div>
			{else}
				{if $CFG.admin.navigation.top}
						{include file='pagination.tpl'}
				{/if}
					<table cellpadding="0" summary="{$LANG.category_view_tbl_summary}">
						<tr>
							<th>&nbsp;<input type="checkbox" name="checkall" id="checkall" tabindex="{smartyTabIndex}" onclick="selectAll(this.form)"/></th>
							<th>{$LANG.category_sub_name}</th>
							<th>{$LANG.category_question_count}</th>
							{if $CFG.admin.module.debate}
								<th>{$LANG.category_debate_count}</th>
							{/if}
							<th>{$LANG.common_status}</th>
							<th>{$LANG.common_date_added}</th>
							<th>{$LANG.common_manage}</th>
						</tr>
					{foreach key=inc item=value from=$myobj->form_view_sub_category.showSubCategory.row}
							<tr>
								<td>
									<input type="checkbox" name="cat_ids[]" value="{$value.record.cat_id}" onClick="disableHeading('formViewCategory');" tabindex="{smartyTabIndex}" />
								</td>
								<td>{$value.record.cat_name}</td>
								<td>{$value.record.total_questions}</td>
								{if $CFG.admin.module.debate}
									<td>{$value.record.total_debates}</td>
								{/if}
								<td>{$value.record.status}</td>
								<td>{$value.record.date_added}</td>
								<td class="clsEditGroupLinks"><a class="clsEditGroupLink" href="{$value.questionCategory_url}">{$LANG.common_edit}</a></td>
							</tr>
					{/foreach}
						<tr>
							<td colspan="6"  class="clsButtonAlignment {$myobj->getCSSFormFieldCellClass('action')}">
								<select name="action" id="action" tabindex="{smartyTabIndex}" >
								{foreach key=inc item=value from=$myobj->form_view_sub_category.showSubCategory.populateFilterList}
									<option value="{$value.key}" {$value.selected_chk}>{$value.name}</option>
								{/foreach}
								</select>
								<a href="#" id="dAltMlti"></a>
								<input type="button" class="clsSubmitButton" name="category_action" id="category_action" onclick="{$myobj->form_view_sub_category.showSubCategory.getMultiCheckBoxValue}" value="{$LANG.common_submit}" tabindex="{smartyTabIndex}" />
							</td>
						</tr>
					</table>

				{if $CFG.admin.navigation.bottom}
					 {include file='pagination.tpl'}
				{/if}
			{/if}

		</form>
	</div>

	{/if}

</div>
</div>