Exemple #1
0
 *
 */
require_once('includes/common.php');
require_once('includes/SI_User.php');

checkLogin("admin");

$user = new SI_User();
$_REQUEST['show_all'] = strtolower(substr($_REQUEST['show_all'],0,1)) == "y" ? TRUE : FALSE;

if($_REQUEST['show_all']){
	$clause = "WHERE u.deleted = 'N'";
}else{
	$clause = "WHERE u.active = 'Y' AND u.deleted = 'N'";
}
$users = $user->getAll("$clause ORDER BY first_name, last_name");
if($users === FALSE){
	$error_msg .= "Error getting users!\n";
	debug_message($user->getLastError());
}

$title = "User Administration";

require('header.php') ?>
<div class="tableContainer">
<a href="javascript:;" class="tCollapse" onclick="toggleGrid(this)"><img src="images/arrow_down.jpg" alt="Hide table" />Users</a>
<div>
	<div class="gridToolbar">
		<a href="user.php?mode=add" style="background-image:url(images/new_invoice.png);">New user</a>
		<a href="<?php 
echo $_SERVER['PHP_SELF'] . "?show_all=y";
 function guessMappings()
 {
     $si_user = new SI_User();
     $si_users = $si_user->getAll();
     if ($si_users !== false) {
         for ($i = 0; $i < count($si_users); $i++) {
             $normalized_name = $this->normalize($si_users[$i]->first_name . ' ' . $si_users[$i]->last_name);
             if (isset($this->users[$normalized_name])) {
                 $this->users[$normalized_name]['action'] = SI_IMPORT_ACTION_MAP;
                 $this->users[$normalized_name]['param'] = $si_users[$i]->id;
                 continue;
             }
             $normalized_name = $this->normalize($si_users[$i]->last_name . ' ' . $si_users[$i]->first_name);
             if (isset($this->users[$normalized_name])) {
                 $this->users[$normalized_name]['action'] = SI_IMPORT_ACTION_MAP;
                 $this->users[$normalized_name]['param'] = $si_users[$i]->id;
                 continue;
             }
         }
     }
     $si_task = new SI_Task();
     $si_tasks = $si_task->retrieveSet();
     if ($si_tasks !== false) {
         for ($i = 0; $i < count($si_tasks); $i++) {
             $normalized_name = $this->normalize($si_tasks[$i]->name);
             if (isset($this->tasks[$normalized_name])) {
                 $this->tasks[$normalized_name]['action'] = SI_IMPORT_ACTION_MAP;
                 $this->tasks[$normalized_name]['param'] = $si_tasks[$i]->id;
                 continue;
             }
         }
     }
     $si_item_code = new SI_ItemCode();
     $si_item_codes = $si_item_code->retrieveSet();
     if ($si_item_codes !== false) {
         for ($i = 0; $i < count($si_item_codes); $i++) {
             $normalized_name = $this->normalize($si_item_codes[$i]->code);
             if (isset($this->item_codes[$normalized_name])) {
                 $this->item_codes[$normalized_name]['action'] = SI_IMPORT_ACTION_MAP;
                 $this->item_codes[$normalized_name]['param'] = $si_item_codes[$i]->id;
                 continue;
             }
             $normalized_name = $this->normalize($si_item_codes[$i]->description);
             if (isset($this->item_codes[$normalized_name])) {
                 $this->item_codes[$normalized_name]['action'] = SI_IMPORT_ACTION_MAP;
                 $this->item_codes[$normalized_name]['param'] = $si_item_codes[$i]->id;
                 continue;
             }
             $normalized_name = $this->normalize($si_item_codes[$i]->code . ' - ' . $si_item_codes[$i]->description);
             if (isset($this->item_codes[$normalized_name])) {
                 $this->item_codes[$normalized_name]['action'] = SI_IMPORT_ACTION_MAP;
                 $this->item_codes[$normalized_name]['param'] = $si_item_codes[$i]->id;
                 continue;
             }
         }
     }
 }