<?php
    if (isset($tpl['status']))
    {
        $status = __('status', true);
        switch ($tpl['status'])
        {
            case 2:
                pjUtil::printNotice(NULL, $status[2]);
                break;
        }
    } else {

        $titles = __('error_titles', true);
        $bodies = __('error_bodies', true);
        ?>
        <form action="<?php echo $_SERVER['PHP_SELF']; ?>?controller=pjAdminClients&amp;action=pjActionUpdate&id=<?php echo $tpl['client']['id']; ?>" method="post" id="frmUpdateClient" class="form pj-form" autocomplete="off">
            <input type="hidden" name="id" value="<?php echo $tpl['client']['id']; ?>">
            <p>
                <label class="title"><?php __('lblClientTimezone'); ?>:</label>
                <select name="timezone" id="timezone" class="pj-form-field w500">
                    <?php
                        $timezones = DateTimeZone::listIdentifiers();
                        foreach ($timezones as $timezone) {
                            echo sprintf('<option value="%1$s" %2$s>%1$s</option>', $timezone, (($timezone == $tpl['client']['timezone']) ? 'selected="selected"' : ''));
                        }
                    ?>
                </select>
            </p>
            <p style="position: relative">
                <label class="title"><?php __('lblEmail'); ?></label>
                <span class="pj-form-field-custom pj-form-field-custom-before">
                    <span class="pj-form-field-before"><abbr class="pj-form-field-icon-email"></abbr></span>
                    <input type="text" name="email" id="email" class="pj-form-field required email w200" value="<?php echo $tpl['client']['email']; ?>" />
                </span>
            </p>
            <p style="position: relative">
                <label class="title"><?php __('lblUsername'); ?></label>
                <span class="pj-form-field-custom pj-form-field-custom-before">
                    <span class="pj-form-field-before"><abbr class="pj-form-field-icon-user"></abbr></span>
                    <input type="text" name="username" id="username" class="pj-form-field required w200" value="<?php echo $tpl['client']['username']; ?>" />
                </span>
            </p>
            <p>
                <label class="title"><?php __('lblPassword'); ?></label>
                <span class="pj-form-field-custom pj-form-field-custom-before">
                    <span class="pj-form-field-before"><abbr class="pj-form-field-icon-password"></abbr></span>
                    <input type="text" name="password" id="password" class="pj-form-field required w200" value="<?php echo $tpl['client']['password']; ?>" />
                </span>
            </p>
            <?php
            if($controller->isSuperAdmin())
            {
                ?>
                <p>
                    <label class="title"><?php __('lblTutor'); ?></label>
                    <span class="inline_block">
                    	<select name="tutor_id" id="tutor_id" class="pj-form-field required w200">
                    		<option value="">-- <?php __('lblChoose'); ?>--</option>
                            <?php
                            foreach ($tpl['tutor_arr'] as $k => $v)
                            {
                                ?><option value="<?php echo $v['id']; ?>"<?php echo $v['id'] == $tpl['client']['tutor_id'] ? ' selected="selected"' : NULL; ?>><?php echo pjSanitize::clean($v['name']); ?></option><?php
                            }
                            ?>
                        </select>
                    </span>
                </p>
                <?php
            }else{
                ?>
                <p>
                    <label class="title"><?php __('lblTutor'); ?></label>
                    <span class="inline_block t5">
                    	<?php
                    	if(!empty($tpl['client']['tutor']))
                    	{
                    	    echo pjSanitize::clean($tpl['client']['tutor']);
                    	}else{
                    	    __('lblNA');
                    	}
                    	?>
                    </span>
                </p>
                <?php
            }
            ?>
            <p>
                <label class="title"><?php __('employee_status'); ?></label>
                <span class="inline_block">
                    <select name="active" id="active" class="pj-form-field required">
                        <option value="">-- <?php __('lblChoose'); ?>--</option>
                        <?php
                        foreach (__('u_statarr', true) as $k => $v)
                        {
							echo $k.' '.$tpl['client']['active'];
                            ?><option value="<?php echo $k; ?>"<?php echo $k == $tpl['client']['active'] ? ' selected="selected"' : NULL; ?>><?php echo $v; ?></option><?php
                        }
                        ?>
                    </select>
                </span>
            </p>
            <p>
                <label class="title">&nbsp;</label>
                <input type="submit" value="<?php __('btnSave', false, true); ?>" class="pj-button" />
                <input type="button" value="<?php __('btnCancel'); ?>" class="pj-button" onclick="window.location.href='<?php echo PJ_INSTALL_URL; ?>index.php?controller=pjAdminClients&action=pjActionIndex';" />
            </p>
        </form>

        <script type="text/javascript">
            var myLabel = myLabel || {};
        </script>
        <?php
    }
?>