Exemplo n.º 1
0
Arquivo: State.php Projeto: jivoo/core
 /**
  * Construct state.
  *
  * @param Store $store
  *            Store to load/save data from/to.
  * @param bool $mutable
  *            Whether state is mutable (true) or read-only (false).
  * @throws AccessException If state could not be read.
  */
 public function __construct(Store $store, $mutable = true)
 {
     parent::__construct();
     $this->store = $store;
     try {
         $this->store->open($mutable);
         $this->data = $this->store->read();
     } catch (AccessException $e) {
         throw new AccessException('Could not read state: ' . $e->getMessage(), null, $e);
     }
 }
Exemplo n.º 2
0
 /**
  * Construct state.
  * @param Store $store Store to load/save data from/to.
  * @throws AccessException If state could not be read.
  */
 public function __construct(Store $store)
 {
     parent::__construct();
     $this->store = $store;
     try {
         $this->store->open(true);
         $this->data = $this->store->read();
     } catch (AccessException $e) {
         throw new AccessException(tr('Could not open session: %1', $e->getMessage()), null, $e);
     }
 }
Exemplo n.º 3
0
 /**
  * Reload configuration document from store.
  */
 public function reload()
 {
     if ($this->root !== $this) {
         $this->root->reload();
         return;
     }
     if (!isset($this->store)) {
         return;
     }
     if (!$this->store->touch()) {
         return;
     }
     try {
         $this->store->open(false);
         $this->data = $this->store->read();
     } catch (StoreException $e) {
     }
     $this->store->close();
 }
Exemplo n.º 4
0
 /**
  * Reload configuration document from store.
  * @throws AccessException If file could not be read.
  */
 public function reload()
 {
     if ($this->root !== $this) {
         $this->root->reload();
         return;
     }
     if (!isset($this->store)) {
         return;
     }
     if (!$this->store->touch()) {
         return;
     }
     try {
         $this->store->open(false);
         $this->data = $this->store->read();
     } catch (AccessException $e) {
         throw new AccessException('Could not read configration: ' . $e->getMessage(), null, $e);
     }
     $this->store->close();
 }
Exemplo n.º 5
0
<?php 
if (!Forms::checkPermission(FORM_LOT_NEW)) {
    return;
}
require_once 'inc/class.item.php';
require_once 'inc/class.store.php';
$db = Database::getInstance();
$itemid = isset($_GET['item']) && is_numeric($_GET['item']) ? $_GET['item'] : "";
$storeid = isset($_GET['store']) && is_numeric($_GET['store']) ? $_GET['store'] : "";
$item = new Item();
$store = new Store();
if ($itemid) {
    $item->read($itemid);
}
if ($storeid) {
    $store->read($storeid);
}
include 'inc/widget/error.php';
?>

<form action="" method="post">
	<table class="form">
	<tr>
		<td class="label">Nombre:</td>
		<td>
			<?php 
if ($itemid) {
    echo "<input type='hidden' name='itemid' value='{$itemid}'/><span>{$item->name}, {$item->type}</span>";
} else {
    $items = Item::getAll("name", "");
    echo "<select name='itemid' id='items'>";
Exemplo n.º 6
0
<p class="form-title">Detalle de Lote</p>
<?php 
if (!Forms::checkPermission(FORM_LOT_EDIT)) {
    return;
}
require_once 'inc/class.item.php';
require_once 'inc/class.store.php';
require_once 'inc/class.lot.php';
require_once 'inc/class.formatter.php';
$lot = new Lot();
$item = new Item();
$store = new Store();
$lotid = isset($_GET['lot']) && is_numeric($_GET['lot']) ? $_GET['lot'] : 0;
if ($lot->read($lotid)) {
    $item->read($lot->itemid);
    $store->read($lot->storeid);
}
include 'inc/widget/error.php';
?>
<form method="post">
	<table class="form">
	<tr>
		<td class="label">Lote Nro.:</td>
		<td><?php 
echo $lot->id;
?>
</td>
	</tr>
	<tr>
		<td class="label">Producto:</td>
		<td><?php 
if (!Forms::checkPermission(FORM_USER_DETAIL)) {
    return;
}
require 'inc/class.store.php';
require 'inc/class.user.php';
require_once 'inc/class.log.php';
$userid = isset($_GET['user']) && is_numeric($_GET['user']) ? $_GET['user'] : -1;
$user = new User();
$store = new Store();
if (!$user->read($userid)) {
    $log = Log::getInstance();
    $log->addError("Informaci&oacute;n de Usuario no disponible");
} else {
    if ($user->storeid) {
        $store->read($user->storeid);
    }
}
?>
<p class="form-title">Informaci&oacute;n de Usuario</p>
	<?php 
include 'inc/widget/error.php';
?>
	<table class="form">
	<tbody>
	<tr>
		<td class="label">Nombre:</td>
		<td><?php 
echo $user->firstname;
?>
</td>
<p class="form-title">Almacen</p>
<?php 
require 'inc/class.store.php';
require_once 'inc/class.log.php';
$storeid = isset($_GET['store']) ? $_GET['store'] : "";
$log = Log::getInstance();
$store = new Store();
if ($storeid != "new" && (!$storeid || !$store->read($storeid))) {
    $log->addError("");
}
include 'inc/widget/error.php';
if (isset($_POST['storeid']) && isset($_POST['page']) && !$log->isError()) {
    include 'inc/widget/success.php';
}
?>
<form action="" method="post" enctype="multipart/form-data">
	<table class="form">
	<tbody>
	<tr>
		<td class="label">Nombre:</td>
		<td><input name="name" type="text" id="name" value="<?php 
echo $store->name;
?>
" size="60"> <span class="mandatory">*</span></td>
	</tr>
	<tr>
		<td class="label">Nombre de Contacto:</td>
		<td><input name="contact" type="text" id="contact" value="<?php 
echo $store->contact;
?>
" size="60"> <span class="mandatory">*</span></td>
<p class="form-title">Almacen</p>
<?php 
require 'inc/class.store.php';
require_once 'inc/class.log.php';
$storeid = isset($_GET['store']) ? $_GET['store'] : "";
$log = Log::getInstance();
$store = new Store();
if (!$storeid || !$store->read($storeid)) {
    $log->addError(INFORMATION_UNAVAILABLE);
}
include 'inc/widget/error.php';
?>

<table class="form">
<tbody>
<tr>
	<td class="label">Nombre:</td>
	<td><?php 
echo $store->name;
?>
</td>
</tr>
<tr>
	<td class="label">Nombre de Contacto:</td>
	<td><?php 
echo $store->contact;
?>
</td>
</tr>
<tr>
	<td class="label">Tel&eacute;fono:</td>