<?php
if (isset($tpl['status']))
{
	$status = __('status', true);
	switch ($tpl['status'])
	{
		case 2:
			pjUtil::printNotice(NULL, $status[2]);
			break;
	}
} else {
	
	pjUtil::printNotice(__('infoAddNoteTitle', true), __('infoAddNoteBody', true)); 
	?>
	<form action="<?php echo $_SERVER['PHP_SELF']; ?>?controller=pjAdminNotes&amp;action=pjActionCreate" method="post" id="frmCreateNote" class="form pj-form" autocomplete="off">
		<input type="hidden" name="note_create" value="1" />
		<p>
			<label class="title120"><?php __('lblTitle'); ?></label>
			<span class="inline_block">
				<input type="text" name="title" id="title" class="pj-form-field w300 required" />
			</span>
		</p>
		<p>
			<label class="title120"><?php __('lblNote'); ?></label>
			<span class="inline_block">
				<textarea id="note" name="note" class="mceEditor required" style="width: 600px; height: 250px"></textarea>
			</span>
		</p>
		<p>
			<label class="title120"><?php __('lblGroupAccess'); ?></label>
			<span class="inline_block">
				<?php
				if(!empty($tpl['group_arr']))
				{ 
					?>
					<select id="group_id" name="group_id[]" class="pj-form-field w400" data-placeholder="--<?php __('lblChoose'); ?>--" multiple="multiple">
						<?php
						foreach ($tpl['group_arr'] as $k => $v)
						{
							?><option value="<?php echo $v['id']; ?>"><?php echo $v['group_title']; ?></option><?php
						}
						?>
					</select>
					<?php
				}else{
					$message = __('lblNoGroupsFound', true);
					$message = str_replace("{STAG}", '<a href="'.$_SERVER['PHP_SELF'] . '?controller=pjAdminGroups&amp;action=pjActionCreate">', $message);
					$message = str_replace("{ETAG}", '</a>', $message);
					?>
					<label class="block t5"><?php echo $message;?></label>
					<?php
				} 
				?>
			</span>
		</p>
		<p>
			<label class="title120"><?php __('lblMemberAccess'); ?></label>
			<span class="inline_block">
				<?php
				if(!empty($tpl['member_arr']))
				{ 
					?>
					<select id="member_id" name="member_id[]" class="pj-form-field w400" data-placeholder="--<?php __('lblChoose'); ?>--" multiple="multiple">
						<?php
						foreach ($tpl['member_arr'] as $k => $v)
						{
							?><option value="<?php echo $v['id']; ?>"><?php echo $v['first_name'] . ' ' . $v['last_name']; ?></option><?php
						}
						?>
					</select>
					<?php
				}else{
					$message = __('lblNoMembersFound', true);
					$message = str_replace("{STAG}", '<a href="'.$_SERVER['PHP_SELF'] . '?controller=pjAdminMembers&amp;action=pjActionCreate">', $message);
					$message = str_replace("{ETAG}", '</a>', $message);
					?>
					<label class="block t5"><?php echo $message;?></label>
					<?php
				} 
				?>
			</span>
		</p>
		<p>
			<label class="title120">&nbsp;</label>
			<input type="submit" value="<?php __('btnSave'); ?>" class="pj-button pj-button-save" />
			<input type="button" value="<?php __('btnCancel'); ?>" class="pj-button" onclick="window.location.href='<?php echo PJ_INSTALL_URL; ?>index.php?controller=pjAdminNotes&action=pjActionIndex';" />
		</p>
	</form>
	<script type="text/javascript">
		var myLabel = myLabel || {};
	</script>
	<?php
}
?>