Beispiel #1
0
	public function getLabUsersTable($user_list, $lab_config_id, $to_export=false)
	{
		# Returns HTML table of lab users
		# Called from lab_config_home.php
		if(count($user_list) == 0)
		{
			echo "<div class='sidetip_nopos'>".LangUtil::$generalTerms['MSG_NOTFOUND']."</div>";
			return;
		}
		?>
		<table class='hor-minimalist-b' style='width:700px;'>
			<thead>
				<tr valign='top'>
					<th>
						#
					</th>
					<th>
						<?php echo LangUtil::$generalTerms['USERNAME']; ?>
					</th>
					<th>
						<?php echo LangUtil::$generalTerms['TYPE']; ?>
					</th>
					<?php
					if($to_export == false)
					{
					?>
					<th>
					</th>
					<?php
					}
					?>
				</tr>
			</thead>
			<tbody>
			<?php
			$count = 1;
			foreach($user_list as $user)
			{
				?>
					<tr valign='top'>
						<td>
							<?php echo $count; ?>.
						</td>
						<td>
							<?php echo $user->username; ?>
						</td>
						<td>
							<?php echo get_level_name($user->level); ?>
						</td>
						<?php
						if($to_export == false)
						{
						?>
						<td>
							<a href='reports_userlog.php?username=<?php echo $user->userId; ?>&location=<?php echo $lab_config_id; ?>' target='_blank'>
							<?php echo LangUtil::$pageTerms['RECENT_ACTIVITY']; ?>
							</a>
							&nbsp;&nbsp;&nbsp;&nbsp;
							<a href="lab_user_edit.php?id=<?php echo $user->userId; ?>&backurl=lab_config_home.php?id=<?php echo $lab_config_id; ?>">
							<?php echo LangUtil::$generalTerms['CMD_EDIT']; ?>
							</a>
							&nbsp;&nbsp;&nbsp;&nbsp;
							<a href='javascript:ask_to_delete_user(<?php echo $user->userId; ?>);'><?php echo LangUtil::$generalTerms['CMD_DELETE']; ?></a>
							<br>
							<?php
							$div_id = 'delete_confirm_'.$user->userId;
							$message = "'$user->username' - ".LangUtil::$generalTerms['TIPS_ACC_CONFIRMDELETE'];
							$ok_function_call = "javascript:delete_user($user->userId);";
							$cancel_function_call = "javascript:toggle('$div_id');";
							$this->getConfirmDialog($div_id, $message, $ok_function_call, $cancel_function_call, $width=200);
							?>
						</td>
						<?php
						}
						?>
					</tr>
				<?php
				$count++;
			}
			?>
			</tbody>
		</table>
		<?php
	}
Beispiel #2
0
    ?>
								<tr>
									<td class="center"><?php 
    echo $counter++;
    ?>
</td>
									<td><?php 
    echo $val->name;
    ?>
</td>
									<td><?php 
    echo $val->username;
    ?>
</td>
									<td><?php 
    echo get_level_name($val->level);
    ?>
</td>
									<td class="center">
										<a href="<?php 
    echo base_url('user/edit/' . $val->uid);
    ?>
" class="btn btn-mini btn-primary tip" title="Edit"><i
											class="icon-pencil"></i></a> 
										<a href="javascript:void(0)" onclick="del('<?php 
    echo base_url('user/delete/' . $val->uid);
    ?>
','<?php 
    echo $val->name;
    ?>
')"
             $return_string = $return_string . "style=\"display:none;\"";
         }
         $return_string = $return_string . ">" . "<table id=\"search_table\" class=\"report\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">" . "<colgroup>" . "<col class=\"num\"/>" . "<col class=\"ProbType\"/>" . "<col class=\"ProbDesc\"/>" . "<col class=\"ProbCategory\"/>" . "<col class=\"ProbLevel\"/>" . "<col class=\"ProbMemo\"/>" . "<col class=\"ProbStatus\"/>" . "<col class=\"ProbAction\"/>" . "</colgroup>" . "<tr>" . "<th>编号</th>" . "<th>类型</th>" . "<th>描述</th>" . "<th>分类</th>" . "<th>难易</th>" . "<th>备注</th>" . "<th>状态</th>" . "<th>动作</th>" . "</tr>";
     }
     if ($page_count < $page_size) {
         $row = mysqli_fetch_assoc($result);
         $ProbId = $row["ProblemId"];
         $ProbType = $row["ProblemType"];
         $ProbTypeStr = get_type_name_from_id($ProbType);
         $ProbDesc = $row["ProblemDesc"];
         $ProbCategory = $row["ProblemCategory"];
         $funcs_id = get_function_id($ProbCategory);
         $funcs_name = get_funcs_name($funcs_id);
         $funcs_name_str = get_funcs_name_str($funcs_name);
         $ProbLevel = $row["ProblemLevel"];
         $ProbLevelStr = get_level_name($ProbLevel);
         $ProbMemo = $row["ProblemMemo"];
         $ProbStatus = $row["Status"];
         $StatusStr = $ProbStatus == 0 ? "下架" : "上架";
         $StatusAction = $ProbStatus == 1 ? "下架" : "上架";
         $page_count_display = $page_count + 1;
         $return_string = $return_string . "<tr>" . "<td>{$page_count_display}</td>" . "<td><span class=\"ProbType fixWidth\">{$ProbTypeStr}</span></td>" . "<td><span class=\"ProbDesc fixWidth\">{$ProbDesc}</span></td>" . "<td><span class=\"ProbCategory fixWidth\">{$funcs_name_str}</span></td>" . "<td><span class=\"ProbLevel fixWidth\">{$ProbLevelStr}</span></td>" . "<td><span class=\"ProbMemo fixWidth\">{$ProbMemo}</span></td>" . "<td>{$StatusStr}</td>" . "<td><A OnClick=\"actionSearchProbs({$ProbId},{$ProbStatus});\">{$StatusAction}</A><br/>" . "<A OnClick=\"modifySearchProbs({$ProbId});\">修改</A><br/>" . "<A OnClick=\"deleteSearchProbs({$ProbId});\">删除</A></td>" . "</tr>";
         $i++;
         $page_count++;
         if ($page_count == $page_size) {
             $return_string = $return_string . "</table>" . "</div>\n";
             $page_no++;
             $page_count = 0;
         }
     }
 }
Beispiel #4
0
							<?php 
echo form_password(array('name' => 'password2', 'class' => 'span6', 'value' => set_value('password2')));
?>
						</div>
					</div>
					<div class="separator bottom"></div>
					<div class="row-fluid">
						<div class="span3">
							<label for="inputTitle">Level *</label>
						</div>
						<div class="span9">
							<?php 
//echo form_input(array('name' => 'level', 'class'=>'span6', 'value'=>isset($_POST['provinsi']) ? set_value('provinsi') : $datas['nama_provinsi']))
?>
							<?php 
echo form_dropdown('level', get_level_name(null, 'Pilih Level'), isset($_POST['level']) ? set_value('level') : $datas['level'], 'class="span6"');
?>
						</div>
					</div>
					<hr class="separator">
					<div>
						<button type="submit" class="btn btn-icon btn-primary glyphicons circle_ok"><i></i>Save</button>
						<button type="button" class="btn btn-icon btn-default glyphicons circle_remove" onclick="window.location='<?php 
echo base_url('user');
?>
'"><i></i>Cancel</button>
					</div>
					<?php 
echo form_close();
?>
				</div>
   
   
                <div class="row">
                    <div class="col-md-12">
                        <div class="panel panel-default">
                            <div class="panel-heading"> 
                                <h3 class="panel-title">题目</h3> 
                            </div> 
                            <div class="panel-body"> 
   <div class="problem_info">
      <table class="problems_table table">
         <th style="width:3%">编号</th><th style="width:5%">题型</th><th style="width:5%">难易</th><th>描述</th>
<?php 
for ($i = 0; $i < count($problems); $i++) {
    $sequence = $i + 1;
    echo "<tr><td>" . $sequence . "</td><td>" . get_type_name_from_id($problems[$i]->type) . "</td><td>" . get_level_name($problems[$i]->level) . "</td><td>" . $problems[$i]->desc . "</td></tr>";
}
?>
         
      </table>
   </div>
<?php 
if ($ExamStatus != 1) {
    ?>
       
      <tr>
         <th colspan="4" class="submitBtns">
            <a class="btn_submit_new modifyExamsContent"><input name="modifyExamsButton" type="button" value="保存" OnClick="modifyExamsContent(<?php 
    echo $ExamId;
    ?>
)"></a>
Beispiel #6
0
    public function getLabUserTypesTable($user_list, $lab_config_id, $to_export = false)
    {
        # Returns HTML table of lab users
        # Called from lab_config_home.php
        if (count($user_list) == 0) {
            echo "<div class='sidetip_nopos'>" . LangUtil::$generalTerms['MSG_NOTFOUND'] . "</div>";
            return;
        }
        ?>
		<table class='hor-minimalist-b' style='width:700px;'>
			<thead>
				<tr valign='top'>
					<th>
						Level
					</th>
					<th>
						Type
					</th>
					<th>
						Default
					</th>
					<?php 
        if ($to_export == false) {
            ?>
					<th>
					</th>
					<?php 
        }
        ?>
				</tr>
			</thead>
			<tbody>
			<?php 
        $count = 1;
        foreach ($user_list as $user) {
            ?>
					<tr valign='top'>
						<td>
							<?php 
            echo $user->level;
            ?>
.
						</td>
						<td>
							<?php 
            $val = get_level_name($user->level);
            if ($val == null) {
                echo $user->name;
            } else {
                echo $val;
            }
            ?>
						</td>
						<td>
							<?php 
            if ($user->defaultdisplay) {
                echo "Yes";
            } else {
                echo "No";
            }
            ?>
						</td>
						<?php 
            if ($to_export == false) {
                ?>
						<td>
							<a href="lab_user_type_edit.php?type=<?php 
                echo $user->level;
                ?>
&backurl=lab_config_home.php?id=<?php 
                echo $lab_config_id;
                ?>
"> 
							<!-- <a href="lab_user_edit.php?id=<?php 
                echo "521";
                ?>
&backurl=lab_config_home.php?id=<?php 
                echo $lab_config_id;
                ?>
"> -->
							<?php 
                echo LangUtil::$generalTerms['CMD_EDIT'];
                ?>
							</a>
							&nbsp;&nbsp;&nbsp;&nbsp;
							<a href='javascript:ask_to_delete_user_type(<?php 
                echo $user->level;
                ?>
);'><?php 
                echo LangUtil::$generalTerms['CMD_DELETE'];
                ?>
</a>
							<br>
							<?php 
                $div_id = 'delete_confirm_' . $user->level;
                $message = "'{$user->name}' - Are you sure you want to delete this user type?";
                $ok_function_call = "javascript:delete_user_type({$user->level});";
                $cancel_function_call = "javascript:toggle('{$div_id}');";
                $this->getConfirmDialog($div_id, $message, $ok_function_call, $cancel_function_call, $width = 200);
                ?>
						</td>
						<?php 
            }
            ?>
					</tr>
				<?php 
            $count++;
        }
        ?>
			</tbody>
		</table>
		<?php 
    }
Beispiel #7
0
    if (!($res = @mysql_query($query))) {
        trigger_error(mysql_error(), E_USER_ERROR);
    }
    $memberships = array();
    while ($rsrow = mysql_fetch_row($res)) {
        $memberships[$rsrow[0]] = $rsrow[1];
    }
    $query = "SELECT a.`pcat_id`,a.`access_level`,b.`lang_value` as `pcat_name` FROM {$from} WHERE {$where} {$orderby} LIMIT {$o},{$r}";
    if (!($res = @mysql_query($query))) {
        trigger_error(mysql_error(), E_USER_ERROR);
    }
    $i = 0;
    while ($rsrow = mysql_fetch_assoc($res)) {
        $loop[$i] = $rsrow;
        $loop[$i] = sanitize_and_format($loop[$i], TYPE_STRING, $__field2format[TEXT_DB2DISPLAY]);
        $loop[$i]['access_level'] = get_level_name($loop[$i]['access_level'], $memberships);
        ++$i;
    }
    $output['pager2'] = pager($totalrows, $o, $r);
}
$output['return2me'] = 'profile_categories.php';
if (!empty($_SERVER['QUERY_STRING'])) {
    $output['return2me'] .= '?' . $_SERVER['QUERY_STRING'];
}
$output['return2me'] = rawurlencode($output['return2me']);
$tpl->set_file('content', 'profile_categories.html');
$tpl->set_loop('loop', $loop);
$tpl->set_var('output', $output);
$tpl->process('content', 'content', TPL_LOOP | TPL_NOLOOP);
$tpl->drop_loop('loop');
unset($loop);
Beispiel #8
-1
 public function google()
 {
     $this->load->model('user_model');
     $data = array();
     require_once APPPATH . 'libraries/google-api-php-client/src/Google/autoload.php';
     //$this->load->model('users_model');
     /************************************************
     		  ATTENTION: Fill in these values! Make sure
     		  the redirect URI is to this page, e.g:
     		  http://localhost:8080/user-example.php
     		 ************************************************/
     $client_id = '1063903629062-1q9qletmv9v0m7nedfjtq2nu1aabv3mk.apps.googleusercontent.com';
     $client_secret = '_beoTqZJ9LuVxN5SmUT39y-c';
     $redirect_uri = base_url('login/google');
     /************************************************
     		  Make an API request on behalf of a user. In
     		  this case we need to have a valid OAuth 2.0
     		  token for the user, so we need to send them
     		  through a login flow. To do this we need some
     		  information from our API console project.
     		 ************************************************/
     $client = new Google_Client();
     $client->setClientId($client_id);
     $client->setClientSecret($client_secret);
     $client->setRedirectUri($redirect_uri);
     $client->setScopes('email');
     $client->addScope(Google_Service_Analytics::ANALYTICS_READONLY);
     // Handle authorization flow from the server.
     if (!isset($_GET['code'])) {
         $auth_url = $client->createAuthUrl();
         //header('Location: ' . filter_var($auth_url, FILTER_SANITIZE_URL));
         redirect(filter_var($auth_url, FILTER_SANITIZE_URL));
     } else {
         $client->authenticate($_GET['code']);
         $getAccessToken = $client->getAccessToken();
         $tokenData = $client->verifyIdToken()->getAttributes();
         //$this->session->set_userdata('access_token', $getAccessToken);
         $email = getEmail($tokenData);
         if ($email != '') {
             $getUserProfile = $this->user_model->get_single_data(array('email' => $email));
             if ($getUserProfile['uid'] != '') {
                 $status = $getUserProfile['status'];
                 $level = get_level_name($getUserProfile['level']);
                 $idlevel = $getUserProfile['level'];
                 $name = $getUserProfile['name'];
                 $uid = $getUserProfile['uid'];
                 $sessions = array('uid' => $uid, 'email' => $email, 'name' => $name, 'level' => $level, 'idlevel' => $idlevel, 'access_token' => $getAccessToken);
                 // account diblokir/banned
                 if ($status == '0') {
                     $data['message'] = '!! Account anda diblokir. Untuk informasi lebih lanjut, silahkan hubungi Administrator !!';
                     // account aktif
                 } elseif ($status == '1') {
                     $this->session->sess_expiration = '3600';
                     $this->session->set_userdata($sessions);
                     redirect('');
                 }
             } else {
                 $data['message'] = 'Anda tidak terdaftar sebagai admin aplikasi ini. Silahkan hubungi Administrator untuk mendapatkan akses.';
             }
         } else {
             $data['message'] = 'Your Email account is not valid.';
         }
         //$_SESSION['access_token'] = $getAccessToken;
         //$access_token = json_decode($getAccessToken);
         //$_SESSION['new_access_token'] = $access_token['access_token'];
         //$redirect_uri = base_url('');
         //header('Location: ' . filter_var($redirect_uri, FILTER_SANITIZE_URL));
         //redirect(filter_var($redirect_uri, FILTER_SANITIZE_URL));
     }
     $content['CONTENT'] = $this->parser->parse($this->path_view . '/login', $data, true);
     $this->parser->parse($this->settings['default_layout'], $content);
 }