<?php
 	/**
 * user_team_view.php - View team member
 *
 * @author $Author: dtong $
 * @version $Id: user_team_view.php,v 1.2 2011/02/02 11:32:18 dtong Exp $
 * @copyright Copyright (c) 2009, Tiller Software Co., Ltd.
*/

$href 			= osa_imagepath();
$imgdis     	= 'dis_right.gif';
$imgsave			= $href.'forward.gif';
$imgclose		= 'close.gif';
$imgdelete		= 'deletes.gif';
$img_save   	= "<img src=". $href. "$imgdis  title='".lang('goal_team_user_disable')."' border='0' >";
$img_close   	= "<img src=". $href. "$imgclose  title='Close'        border='0' >";
$img_del  		= "<img src=". $href. "$imgdelete    title='Delete'    border='0' >";

$href_save 		= base_url().'goal/team/insert_member/'.$goalid;
$href_editor 	= base_url().'goal/team/set_editor_member/'.$goalid;
$href_del 		= base_url().'goal/team/delete_member/'.$goalid .'/';
//$href_refresh  = base_url().'goal/team/select/'.$mode.'/'.$goalid.'/'.$type;
//$href_goal 	   = base_url().'/goal/goal/edit_goal/'.$mode.'/'.$goalid.'/'.$type;
$href_refresh  = base_url().'goal/team/select/'.$goalid.'/'.$action;
$href_goal 	   = base_url()."/goal/goal/{$url_mode}/".$goalid;

$goal_team_col_user 	=lang('goal_team_col_user');
$goal_team_col_editor	=lang('goal_team_col_editor');
$goal_team_col_delete	=lang('goal_team_col_delete');
$goal_team_selectuser =lang('goal_team_selectuser');
$goal_team_selecteduser=lang('goal_team_selecteduser');
$goal_team_deletemsg=lang('goal_team_deletemsg');
$goal_team_create_by =lang('goal_team_selecteduser');

//$jscript_add = "onClick=\"user_goal('$href_save','$href_refresh','$href_goal', 'team_members_form','team_member');\"";
$refresh_goal =  "ajaxPostform('page_content', '{$href_goal}', ''); return false;";
$jscript_add =  "onClick=\"ajaxPostform('dhtmlwin_team', '{$href_save}', 'team_members_form', false);  return false;\"";

?>
<div id='dhtmlwin_team'>
<form method="POST" name="team_members_form" >
<input id='action' type='hidden' value='<?php echo $action; ?>'></input>
<input id='type' type='hidden' value='<?php echo $type; ?>'></input>
<center>
			<div class="member_title"><?php echo lang('goal_create_title'); ?></div>
			<div class="member_title"><?php echo $title; ?></div>
			<br />
			<table class="user_course_table" border='0'>
				<tr>
					<td class="user_course_dropdownlist" valign=top>
						<div class="member_head"><?php echo $goal_team_selectuser; ?></div>
 						<?php
							if (isset($user) && is_array($user)) {
								$fieldname  = 'userid[]';
								//$button  = "change_button('img_button', '$imgsave', '" . lang('goal_team_user_assign') . "','','team_members_form'); ";

								$button  = "change_button('img_button', '$imgsave', '" . lang('goal_team_user_assign') . "','{$href_save}','team_members_form','dhtmlwin_team');return false; ";
								$jscript = "onChange=\"$button \"";
								echo form_dropdown($fieldname, $user,'',"size='23'  multiple='multiple'\" $jscript ");
							}
						?>
					</td>
					<td class="user_course_image" valign="middle">
						<div id="img_add" >
							<!-- <a id="add" name="add" <?php echo $jscript_add ?> ><span id="img_button" ><?php echo $img_save ?></span></a>  -->
							<span id="img_button" ><?php echo $img_save ?></span>
						</div>
					</td>
					<td class="user_course_data"  valign=top>
					<div class="member_head"><?php echo lang('goal_team_creator') . $creatorname; ?></div><br />
						<div class="member_head"><?php echo $goal_team_selecteduser; ?></div>
						<table class="user_course_table" border='0' >
							<tr>
							<?php
								if($show_editorbox/* && ($usertype == CMS_goal_USER_CREATOR) */) {
							?>
								<th class="user_course_table_header"><?php echo $goal_team_col_editor ?></th>
							<?php
								}
							?>
								<th class="user_course_table_header"><?php echo $goal_team_col_user ?></th>
							<?php
								if( $iseditor /*($usertype == CMS_goal_USER_EDITOR)|| ($usertype == CMS_goal_USER_CREATOR) */) {
							?>
								<th class="user_course_table_header"><?php echo $goal_team_col_delete ?></th>
							<?php
								}
							?>
							</tr>
							<?php
								// create row
								$swap='';
								//echo '<pre>'; print_r($selectlistitem); echo '</pre>';
							  	if (isset($selectlistitem) && is_array($selectlistitem)) {
									foreach ($selectlistitem as $row) {
										if ($swap  == '') {
											$tr_class = "table_body_row";
											$swap = '_none';
										}
										else {
											$tr_class = "table_body_row_none";
											$swap = '';
										}
								// create link editor
								//$href_edit=$href_editor.$row->id.'/'.$row->iseditor;
								//if ($this->config->item('cms_goal_multi_editor')){
									//$jscript_edit = "onClick=\"set_editor_goal('$href_edit','$href_refresh', 'team_members_form','team_member');\"";
								//}
								//else {
									//$jscript_edit = "onClick=\"resetCheckBox('team_members_form','editorlist',this.value); set_editor_goal(this.checked,'$href_edit','$href_refresh', 'team_members_form','team_member');\"";

									$jscript_edit = "onClick=\"ajaxPostform('dhtmlwin_team', '{$href_editor}', 'team_members_form', false);return false;\"";
								//}

								// make link delete
								$href=$href_del.$row->id;
								//$jscript_del = "onClick=\"user_goal('$href','$href_refresh','$href_goal', 'team_members_form','team_member');\"";
								$jscript_del =  "onClick=\"if(confirm('$goal_team_deletemsg')==true) { ajaxPostform('dhtmlwin_team', '{$href}', 'team_members_form', false);return false; } \"";
							?>
							<tr class="<?php echo $tr_class; ?>">
							<?php
								if($show_editorbox /*&& ($usertype == CMS_goal_USER_CREATOR)*/) {
							?>
								<td class="user_course_col_header_del" > <!--
									<input type="checkbox" name="editorlist" id="<?php echo $row->id; ?>" value="<?php echo $row->id; ?>" <?php if($row->iseditor == CMS_goal_USER_EDITOR) { ?>checked="checked"<?php } ?> <?php echo $jscript_edit ?> />

									 -->
									<?php $chk_name = 'editorlist[]'; ?>
									<input type="checkbox" name="<?php echo $chk_name; ?>" id="<?php echo $row->id; ?>" value="<?php echo $row->id; ?>"
										<?php if($row->iseditor == CMS_goal_USER_EDITOR) { ?>checked="checked"<?php } echo $jscript_edit  ?>
									></input>
								</td>
							<?php
								}
							?>
								<td class="user_course_col_header_Name" ><?php echo $row->displayname ; ?></td>
							<?php
								if( $iseditor /*($usertype == CMS_goal_USER_EDITOR)|| ($usertype == CMS_goal_USER_CREATOR)*/) {
							?>
								<td class="user_course_col_header_del" ><a <?php echo $jscript_del ?> ><?php echo $img_del ?></a></td>
							<?php
								}
							?>
							</tr>
							<?php
									} // foreach
								} // if
							?>
						</table>
						<div align="left" style="margin-top:10px">
							<input type="button" value="<?php echo lang('goal_team_button_done'); ?>" name="Done" <?php osa_btn()?>
							onClick="closeDhtmlWindow('team_member'); <?php echo $refresh_goal; ?> return false;" />
						</div>
					</td>
				</tr>
			</table>
			<table width="96%">
				<tr>
					<td>
						<div class="user_course_footer"><?php echo lang('goal_team_footer'); ?></div>
					</td>
				</tr>
			</table>
</center>

</form>
</div>
