本文整理汇总了PHP中Utils::POST方法的典型用法代码示例。如果您正苦于以下问题:PHP Utils::POST方法的具体用法?PHP Utils::POST怎么用?PHP Utils::POST使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utils
的用法示例。
在下文中一共展示了Utils::POST方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: function
<?php
require_once '../libs.php';
Ajax::Angular();
Utils::POST('excel', function () {
Ajax::call($_POST['method']);
});
示例2: userSettings
public static function userSettings($params)
{
$format = $params['args'][1] != '' ? $params['args'][1] : 'html';
$user = User::getAuthenticatedUser();
switch ($params['method']) {
// GET: Get user settings
case 'GET':
$externalLogin = Settings::getProtected('external_login');
$notifications = Settings::getProtected('notifications');
$userNotifications = array();
$adminNotifications = array();
foreach ($notifications as $key => $targets) {
if (in_array('@user', $targets)) {
// User notification
if (!property_exists($user->prefs->notifications, $key)) {
$user->prefs->notifications->{$key} = false;
}
array_push($userNotifications, array('id' => $key, 'selected' => $user->prefs->notifications->{$key}));
} else {
if (in_array('@admin', $targets) && $user->role == 'admin') {
// Admin notification
if (!property_exists($user->prefs->notifications, $key)) {
$user->prefs->notifications->{$key} = false;
}
array_push($adminNotifications, array('id' => $key, 'selected' => $user->prefs->notifications->{$key}));
}
}
}
$response = array('user' => $user->getResponse(), 'externalLogin' => $externalLogin, 'userNotifications' => $userNotifications, 'adminNotifications' => $adminNotifications);
switch ($format) {
case 'json':
echo json_encode($response);
break;
case 'html':
Template::render('settings', $response);
break;
}
break;
// POST: Save user settings
// POST: Save user settings
case 'POST':
$username = Utils::POST('username');
$name = Utils::POST('name');
$email = Utils::POST('email');
$prefs = Utils::POST('prefs');
$user = new User($username);
if ($name != '') {
$user->name = $name;
}
if ($email != '') {
$user->email = $email;
}
$user->prefs = json_encode($prefs);
$retcode = $user->save();
if ($retcode) {
$status = 'success';
} else {
$status = 'error';
}
$response = array('statuscode' => $status);
echo json_encode($response);
break;
}
}
示例3: function
<?php
require 'inc/header.php';
Utils::POST('submit', function () {
Consulta::newConsulta($_POST);
if (Auth::User()->vendedor != 16) {
Mail::informarConsulta($_POST);
}
});
?>
<!-- Header -->
<!--detalle productos-->
<div class="mi-cuenta col-xs-12 col-sm-12 col-md-12 ol-lg-12">
<!--head-page-->
<div class="head-page col-xs-12 col-sm-12 col-md-12 ol-lg-12">
</div>
<!--end / head-page-->
<!--formulario-->
<div class="formulario block-a col-xs-12 col-sm-4 col-md-4 ol-lg-4">
<h3 class="sub-titulo text-uppercase">Nueva Consulta</h3>
<form role="form " method="post" class="form-default">
<div class="form-group">
<label for="text" class="text-uppercase">Asunto</label>
<input type="text" name="asunto">
示例4: function
<?php
require_once '../../libs.php';
Utils::POST('comboFiltro', function () {
Cliente::optionsCombo($_POST['vendedor']);
});
示例5: install
public static function install($params)
{
// Load database
$db = Settings::getProtected('db');
$installed = $db->installed();
// Make sure we haven't already installed
if ($installed) {
// Already installed
Utils::redirectToDashboard('error.already_installed', '');
} else {
// We haven't, so install
switch ($params['method']) {
// GET: Show install form
case 'GET':
Template::render('install', array('external_login' => Settings::getProtected('external_login')));
break;
// POST: Run install script
// POST: Run install script
case 'POST':
// And install
if ($db->install()) {
// Sleep two seconds to make sure the tables are all created
sleep(2);
// Add admin user
$user = new User();
$user->username = Utils::POST('username');
if (Utils::POST('password')) {
$user->password = md5(Utils::POST('password'));
// TODO: make this better
} else {
$user->password = '';
}
$user->role = "admin";
$user->status = "active";
$user->hash = "adminadminadmin";
// doesn't really matter since we don't need to confirm
$user->in_db = false;
$user->save();
// Redirect to admin login page
$auth = Settings::getProtected('auth');
$auth->redirectToLogin();
} else {
Template::render('install', array('status' => 'failed'));
}
break;
}
}
}
示例6: function
<?php
require 'inc/header.php';
Utils::POST('submit', function () {
Consulta::newConsulta($_POST);
Mail::informarConsulta($_POST);
});
?>
<!-- Header -->
<!--detalle productos-->
<div class="mi-cuenta col-xs-12 col-sm-12 col-md-12 ol-lg-12">
<!--head-page-->
<div class="head-page col-xs-12 col-sm-12 col-md-12 ol-lg-12">
</div>
<!--end / head-page-->
<!--formulario-->
<div class="formulario block-a col-xs-12 col-sm-4 col-md-4 ol-lg-4">
<h3 class="sub-titulo text-uppercase">Nueva Consulta</h3>
<form role="form " method="post" class="form-default">
<div class="form-group">
<label for="text" class="text-uppercase">Asunto</label>
<input type="text" name="asunto">
</div>
示例7: items
public static function items($params)
{
$format = Utils::getFormat($params['args'], 0, 2);
$projectType = Utils::getProjectType($params['args']);
$projectSlugIndex = $projectType == 'system' ? 0 : 2;
$projectSlug = $params['args'][$projectSlugIndex];
switch ($params['method']) {
// POST: Run uploaded files through item type uploader modules
case 'POST':
$fileList = Utils::POST('fileList');
$items = array();
foreach ($fileList as $file) {
// Get extension
$ext = pathinfo($file, PATHINFO_EXTENSION);
// Default uploader type
$uploaderType = "Page";
// Get the uploader type from the settings
$uploaders = Settings::getProtected('uploaders');
foreach ($uploaders as $type => $data) {
if (in_array($ext, $data['extensions'])) {
$uploaderType = $type;
break;
}
}
// Load the appropriate class
require_once "../modules/uploaders/{$uploaderType}Uploader.class.php";
$uploaderClass = "{$uploaderType}Uploader";
$uploader = new $uploaderClass($projectSlug);
// Call the uploader (it takes an array)
$returnedItems = $uploader->upload(array($file));
// Merge the arrays
$items = array_merge($items, $returnedItems);
}
// Create a JSON-ready version
$finalItems = array();
foreach ($items as $item) {
$newItem = array("id" => $item->item_id, "title" => $item->title, "project_id" => $item->project_id, "transcript" => $item->transcript, "type" => $item->type, "href" => $item->href);
array_push($finalItems, $newItem);
}
$uploader = new ItemTypeUploader($projectSlug);
$uploader->cleanup();
echo json_encode(array('status' => 'success', 'items' => $finalItems));
break;
}
}
示例8: import
public static function import($params)
{
$appUrl = Settings::getProtected('app_url');
$themeRoot = Settings::getProtected('theme_root');
$format = Utils::getFormat($params['args'], 1, 3);
$projectType = Utils::getProjectType($params['args']);
$projectSlug = $projectType == 'system' ? $params['args'][0] : $params['args'][2];
$user = User::getAuthenticatedUser();
// Load the project
$project = new Project($projectSlug);
RoleController::forceClearance(array('project.admin', 'project.owner', 'system.admin'), $user, array('project' => $project));
if ($project->title == '') {
Utils::redirectToDashboard('', 'Error loading project.');
}
if ($project->type == 'system') {
$projectUrl = "projects/" . $project->slug;
} else {
if ($project->type == 'user') {
$projectUrl = "users/" . $project->owner . "/projects/" . $project->slug;
}
}
$project->getItems();
$projectArray = $project->getResponse();
$projectArray['items'] = $project->items;
$projectArray['url'] = "{$appUrl}/{$projectUrl}";
switch ($params['method']) {
// GET: Get transcript import page
case 'GET':
$response = array('page_title' => 'Import Transcript', 'user' => $user->getResponse(), 'project' => $projectArray);
switch ($format) {
case 'json':
echo json_encode(array('status' => 'success', 'response' => $response));
break;
case 'html':
Template::render('import', $response);
break;
}
break;
// POST: Update transcripts for items
// POST: Update transcripts for items
case 'POST':
$template = Utils::POST('template');
$transcript = Utils::POST('transcript');
$items = Utils::POST('items');
$projectSlug = Utils::POST('projectSlug');
$status = 'success';
// Split the transcript
$splitTranscripts = TranscriptController::splitTranscript($transcript, $template);
// Make sure the number of items still matches, otherwise return error
if (count($splitTranscripts) != count($items)) {
$status = 'error';
}
// Update each item's transcript
for ($i = 0; $i < count($items); $i++) {
$item = new Item($items[$i], $projectSlug);
$item->transcript = $splitTranscripts[$i];
if (!$item->save()) {
$status = 'error';
break;
}
}
echo json_encode(array('status' => $status));
break;
}
}
示例9: function
<?php
require 'inc/header.php';
Utils::POST('submit', function () {
$x = new Usuario();
$x->edit($_POST);
});
$user = Auth::User();
?>
<!-- Header -->
<!--detalle productos-->
<div class="mi-cuenta col-xs-12 col-sm-12 col-md-12 ol-lg-12">
<!--head-page-->
<div class="head-page col-xs-12 col-sm-12 col-md-12 ol-lg-12">
</div>
<!--end / head-page-->
<!--formulario-->
<div class="formulario formularioSidebar block-a col-xs-12 col-sm-7 col-md-7 ol-lg-7">
<h3 class="sub-titulo text-uppercase">Datos</h3>
<form role="form" action="" method="post" class="form-default">
<!--form-a-->
<div class="form-a col-xs-12 col-sm-6 col-md-6 ol-lg-6">
<div class="form-group">
<label for="text" class="text-uppercase">Empresa</label>