本文整理汇总了PHP中Warehouse::setPasswordRestricted方法的典型用法代码示例。如果您正苦于以下问题:PHP Warehouse::setPasswordRestricted方法的具体用法?PHP Warehouse::setPasswordRestricted怎么用?PHP Warehouse::setPasswordRestricted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Warehouse
的用法示例。
在下文中一共展示了Warehouse::setPasswordRestricted方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getWarehouses
/**
* @return array of warehouses.
*/
public static function getWarehouses()
{
$warehouses = array();
$sql = "SELECT * FROM " . Database::getTableName('warehouses') . " ORDER BY country ASC, city ASC, name ASC";
$response = Database::getInstance()->sql('getWarehouses', $sql, '', [], true);
if (is_array($response)) {
foreach ($response as $entry) {
$warehouse = new Warehouse(-1);
$warehouse->id = $entry['id'];
$warehouse->name = $entry['name'];
$warehouse->country = $entry['country'];
$warehouse->city = $entry['city'];
$warehouse->setPassword($entry['password']);
$warehouse->setPasswordRestricted($entry['passwordRestricted']);
$warehouse->setMail($entry['mail']);
$warehouse->setDisableLocationLess($entry['disableLocationLess']);
$warehouse->setDisablePaletteLess($entry['disablePaletteLess']);
array_push($warehouses, $warehouse);
}
}
return $warehouses;
}
示例2: process
public function process()
{
// check if session is active
$session = new Session($this->sessionId);
if ($session->sessionId > 0) {
// update session
$session->update();
// process restricted functions
switch ($this->f) {
case 'checkLogin':
return Login::checkLogin($session->sessionId);
case 'getSession':
return $session;
case 'getWarehouse':
if (isset($this->data->update)) {
$warehouse = new Warehouse($session->warehouseId, $this->data->update);
} else {
$warehouse = new Warehouse($session->warehouseId);
}
$warehouse->dMail = $warehouse->getMail();
$warehouse->dDisableLocationLess = $warehouse->isLocationLessDisabled();
$warehouse->dDisablePaletteLess = $warehouse->isPaletteLessDisabled();
return $warehouse;
case 'editWarehouse':
if (!$session->restricted) {
$data = $this->data;
$warehouse = new Warehouse($session->warehouseId);
// update warehouse data
if (isset($data->name)) {
$warehouse->name = $data->name;
}
if (isset($data->description)) {
$warehouse->description = $data->description;
}
if (isset($data->country)) {
$warehouse->country = $data->country;
}
if (isset($data->city)) {
$warehouse->city = $data->city;
}
if (isset($data->password)) {
$warehouse->setPassword($data->password);
}
if (isset($data->passwordRestricted)) {
$warehouse->setPasswordRestricted($data->passwordRestricted);
}
if (isset($data->mail)) {
$warehouse->setMail($data->mail);
}
if (isset($data->disableLocationLess)) {
$warehouse->setDisableLocationLess($data->disableLocationLess);
}
if (isset($data->disablePaletteLess)) {
$warehouse->setDisablePaletteLess($data->disablePaletteLess);
}
// update database entry
return $warehouse->edit();
}
break;
case 'deleteWarehouse':
if (!$session->restricted) {
$warehouse = new Warehouse($session->warehouseId);
if ($warehouse->id > 0 && $warehouse->delete()) {
return $session->destroy();
}
}
break;
case 'addCategory':
if (!$session->restricted && isset($this->data->name)) {
$category = new Category(null, $session->warehouseId);
$category->name = $this->data->name;
if (isset($this->data->parent)) {
$category->parent = $this->data->parent;
}
if ($category->edit()) {
return $category->id;
}
}
break;
case 'getCategory':
if (isset($this->data->id) && isset($this->data->update)) {
return new Category($this->data->id, $session->warehouseId, $this->data->update);
} elseif (isset($this->data->id)) {
return new Category($this->data->id, $session->warehouseId);
}
break;
case 'deleteCategory':
if (!$session->restricted && isset($this->data->id)) {
$category = new Category($this->data->id, $session->warehouseId);
return $category->delete();
}
break;
case 'editCategory':
if (isset($this->data->id)) {
$data = $this->data;
$category = new Category($this->data->id, $session->warehouseId);
if (!$session->restricted) {
if (isset($data->name)) {
$category->name = $data->name;
}
//.........这里部分代码省略.........