本文整理汇总了PHP中Web::request方法的典型用法代码示例。如果您正苦于以下问题:PHP Web::request方法的具体用法?PHP Web::request怎么用?PHP Web::request使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Web
的用法示例。
在下文中一共展示了Web::request方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit_POST
function edit_POST(Web $w)
{
$p = $w->pathMatch("id");
$processor_id = $p["id"];
// Break the selected processor up into module and class
$processor_class = $w->request("processor_class");
$processor_expl = explode(".", $processor_class);
// Make sure we only have two values
if (count($processor_expl) !== 2) {
$w->error("Missing Processor values", "/channels/listprocessors");
exit;
}
// make sure the selected class exists in config
if (!in_array($processor_expl[1], $w->moduleConf($processor_expl[0], "processors"))) {
$w->error("Could not find processor in config", "/channels/listprocessors");
exit;
}
$processor_object = $processor_id ? $w->Channel->getProcessor($processor_id) : new ChannelProcessor($w);
$processor_object->fill($_POST);
$processor_object->channel_id = $w->request("channel_id");
$processor_object->module = $processor_expl[0];
$processor_object->class = $processor_expl[1];
$processor_object->insertOrUpdate();
$w->msg("Processor " . ($processor_id ? "updated" : "created"), "/channels/listprocessors");
}
示例2: ajaxEditFavorites_ALL
/**
* updates or removes favorited item
*
* @author Steve Ryan, steve@2pisystems.com, 2015
**/
function ajaxEditFavorites_ALL(Web $w)
{
$id = $w->request("id");
$class = $w->request("class");
$user = $w->Auth->user();
$cmd = $w->request("cmd");
if (!empty($id) && !empty($class) && !empty($user) && !empty($cmd)) {
if ($cmd == "add") {
$favorite = new Favorite($w);
$favorite->object_class = $class;
$favorite->object_id = $id;
$favorite->user_id = $user->id;
$favorite->insertOrUpdate();
echo $w->Favorite->getFavoriteButton($id, $class);
} else {
if ($cmd == "remove") {
$favorite = $w->Favorite->getDataByObject($id, $class);
if (get_class($favorite) == "Favorite" && $favorite->id > 0) {
$favorite->delete();
}
echo $w->Favorite->getFavoriteButton($id, $class);
} else {
echo "Invalid request";
}
}
} else {
echo "Invalid request";
}
}
示例3: token_GET
function token_GET(Web &$w)
{
$w->setLayout(null);
$username = $w->request("username");
$password = $w->request("password");
$api = $w->request("api");
$w->out($w->Rest->getTokenJson($username, $password, $api));
}
示例4: results_GET
function results_GET(Web $w)
{
$response = array("success" => true, "data" => "");
$w->setLayout(null);
$q = $w->request('q');
// query
$idx = $w->request('idx');
// index
$p = $w->request('p');
// page
$ps = $w->request('ps');
// pageSize
$tr = $w->request('tr');
// total results
if ($q && strlen($q) >= 3) {
$results = $w->Search->getResults($q, $idx, $p, $ps);
if (empty($p) && empty($ps) && empty($tr)) {
$buffer = "";
if (!empty($results[0])) {
// Group results by class_name
$filter_results = array();
foreach ($results[0] as $res) {
$searchobject = $w->Search->getObject($res['class_name'], $res['object_id']);
if (!empty($searchobject)) {
$filter_results[$res['class_name']][] = $searchobject;
}
}
foreach ($filter_results as $class => $objects) {
// Transform class into readable text
$t_class = preg_replace('/(?<=\\w)(?=[A-Z])/', " \$1", $class);
$buffer .= "<div class='row search-class'><h4 style='padding-top: 10px; font-weight: lighter;'>{$t_class}</h4>";
if (!empty($objects)) {
foreach ($objects as $object) {
if ($object->canList($w->Auth->user())) {
$buffer .= '<div class="panel search-result">';
if ($object->canView($w->Auth->user())) {
$buffer .= "<a class=\"row search-title\" href=\"" . $w->localUrl($object->printSearchUrl()) . "\">{$object->printSearchTitle()}</a>" . "<div class=\"row search-listing\">{$object->printSearchListing()}</div>";
} else {
$buffer .= "<div class=\"small-12 columns search-title\">{$object->printSearchTitle()}</div><div class=\"row search-listing\">(restricted)</div>";
}
$buffer .= "</div>";
}
}
}
$buffer .= "</div>";
}
}
$response["data"] = $buffer;
}
} else {
$response["success"] = false;
$response["data"] = "Please enter at least 3 characters for searching.";
}
echo json_encode($response);
}
示例5: ajaxSaveComment_POST
function ajaxSaveComment_POST(Web $w)
{
$p = $w->pathMatch('parent_id');
$comment = new Comment($w);
$comment->obj_table = "comment";
$comment->obj_id = $p['parent_id'];
$comment->comment = strip_tags($w->request('comment'));
$comment->insert();
$w->setLayout(null);
echo $w->partial("displaycomment", array("object" => $comment, 'redirect' => $w->request('redirect')), "admin");
}
示例6: thumb_GET
function thumb_GET(Web &$w)
{
$filename = str_replace("..", "", FILE_ROOT . $w->getPath());
if (is_file($filename)) {
$width = $w->request("w", FileService::$_thumb_width);
$height = $w->request("h", FileService::$_thumb_height);
require_once 'phpthumb/ThumbLib.inc.php';
$thumb = PhpThumbFactory::create($filename);
$thumb->adaptiveResize($width, $height);
header("Content-Type: image/png");
$thumb->show();
exit;
}
}
示例7: taskAjaxPrioritytoStatus_ALL
function taskAjaxPrioritytoStatus_ALL(Web &$w)
{
$status = array();
// split query string into proirity, type, group and assignee
list($priority, $type, $group, $assignee) = preg_split('/_/', $w->request('id'));
// organise criteria
$who = $assignee != "" ? $assignee : null;
$where = "";
if ($group != "") {
$where .= "task_group_id = " . $group . " and ";
}
if ($type != "") {
$where .= "task_type = '" . $type . "' and ";
}
if ($priority != "") {
$where .= "priority = '" . $priority . "' and ";
}
$where .= "is_closed = 0";
// get statuses from available tasks
$tasks = $w->Task->getTasks($who, $where);
if ($tasks) {
foreach ($tasks as $task) {
if (!array_key_exists($task->status, $status)) {
$status[$task->status] = array($task->status, $task->status);
}
}
}
if (!$status) {
$status = array(array("No assigned Tasks", ""));
}
// load status dropdown and return
$status = Html::select("status", $status, null);
$w->setLayout(null);
$w->out(json_encode($status));
}
示例8: taskAjaxTypetoPriority_ALL
function taskAjaxTypetoPriority_ALL(Web &$w)
{
$priority = array();
// split the query string into type, group and assignee
list($type, $group, $assignee) = preg_split('/_/', $w->request('id'));
// organise criteria
$who = $assignee != "" ? $assignee : null;
$where = "";
if ($group != "") {
$where .= "task_group_id = " . $group . " and ";
}
if ($type != "") {
$where .= "task_type = '" . $type . "' and ";
}
$where .= "is_closed = 0";
// get priorities from available task list
$tasks = $w->Task->getTasks($who, $where);
if ($tasks) {
foreach ($tasks as $task) {
if (!array_key_exists($task->priority, $priority)) {
$priority[$task->priority] = array($task->priority, $task->priority);
}
}
}
if (!$priority) {
$priority = array(array("No assigned Tasks", ""));
}
// load priority dropdown and return
$priority = Html::select("tpriority", $priority, null);
$w->setLayout(null);
$w->out(json_encode($priority));
}
示例9: get_GET
function get_GET(Web &$w)
{
$w->setLayout(null);
$p = $w->pathMatch("classname", "id");
$token = $w->request("token");
$w->out($w->Rest->getJson($p['classname'], $p['id'], $token));
}
示例10: reportAjaxCategorytoType_ALL
function reportAjaxCategorytoType_ALL(Web $w)
{
$type = array();
list($category, $module) = preg_split('/_/', $w->request('id'));
// organise criteria
$who = $w->session('user_id');
$where = array();
if (!empty($module)) {
$where['report.module'] = $module;
}
if (!empty($category)) {
$where['report.category'] = $category;
}
// get report categories from available report list
$reports = $w->Report->getReportsbyUserWhere($who, $where);
if ($reports) {
foreach ($reports as $report) {
$arrtype = preg_split("/,/", $report->sqltype);
foreach ($arrtype as $rtype) {
$rtype = trim($rtype);
if (!array_key_exists(strtolower($rtype), $type)) {
$type[strtolower($rtype)] = array(strtolower($rtype), strtolower($rtype));
}
}
}
}
if (empty($type)) {
$type = array(array("No Reports", ""));
}
$w->setLayout(null);
$w->out(json_encode(Html::select("type", $type)));
}
示例11: attachForm_POST
function attachForm_POST(Web $w)
{
$p = $w->pathMatch("id");
// get relevant task
$task = $w->Task->getTask($p['id']);
// if task exists get REQUEST and FILE object for insert into attachment database against this task
if ($task) {
$description = $w->request('description');
if ($_FILES['form']['size'] > 0) {
$filename = strtolower($_FILES['form']['name']);
$parts = explode(".", $filename);
$n = count($parts) - 1;
$ext = $parts[$n];
$attach = $w->File->uploadAttachment("form", $task, null, $description);
if (!$attach) {
$message = "There was an error. The document could not be saved.";
} else {
$message = "The Document has been uploaded.";
}
}
// create comment
$comm = new TaskComment($w);
$comm->obj_table = $task->getDbTableName();
$comm->obj_id = $task->id;
$comm->comment = "File Uploaded: " . $filename;
$comm->insert();
// add to context for notifications post listener
$w->ctx("TaskComment", $comm);
$w->ctx("TaskEvent", "task_documents");
}
// return
$w->msg($message, "/task/edit/" . $task->id . "#attachments");
}
示例12: taskAjaxGrouptoType_ALL
function taskAjaxGrouptoType_ALL(Web &$w)
{
$types = array();
// split query string into group and assignee
list($group, $assignee) = preg_split('/_/', $w->request('id'));
// organise criteria
$who = $assignee != "" ? $assignee : null;
$where = "";
if ($group != "") {
$where .= "task_group_id = " . $group . " and ";
}
$where .= "is_closed = 0";
// get task types from available task list
$tasks = $w->Task->getTasks($who, $where);
if ($tasks) {
foreach ($tasks as $task) {
if (!array_key_exists($task->task_type, $types)) {
$types[$task->task_type] = array($task->getTypeTitle(), $task->task_type);
}
}
}
if (!$types) {
$types = array(array("No assigned Tasks", ""));
}
// load type dropdown and return
$tasktypes = Html::select("tasktypes", $types, null);
$w->setLayout(null);
$w->out(json_encode($tasktypes));
}
示例13: reportAjaxModuletoCategory_ALL
function reportAjaxModuletoCategory_ALL(Web $w)
{
$category = array();
$module = $w->request('id');
// organise criteria
$who = $w->session('user_id');
$where = array();
if ($module != "") {
$where['report.module'] = $module;
}
// get report categories from available report list
$reports = $w->Report->getReportsbyUserWhere($who, $where);
if ($reports) {
foreach ($reports as $report) {
if (!array_key_exists($report->category, $category)) {
$category[$report->category] = array($report->getCategoryTitle(), $report->category);
}
}
}
if (!$category) {
$category = array(array("No Reports", ""));
}
// load Category dropdown and return
$category = Html::select("category", $category);
$w->setLayout(null);
$w->out(json_encode($category));
}
示例14: doOAuthCall
/**
* perform a signed oauth request
* @param string $url request url
* @param string $method method type
* @param array $params additional params
* @param null $type storage type [sandbox|dropbox]
* @param null $file full file pathname
* @param null $content file content
* @return bool
*/
protected function doOAuthCall($url, $method, $params = null, $type = NULL, $file = NULL, $content = NULL)
{
if (is_null($params)) {
$params = array();
}
$method = strtoupper($method);
$options = array('method' => $method);
if ($method == 'GET') {
if ($file) {
$url .= $type . '/' . $file;
}
$url .= '?' . http_build_query($this->authParams + $params);
} elseif ($method == 'POST') {
$params = $this->authParams + $params + array('root' => $type);
$options['content'] = http_build_query($params);
} elseif ($method == 'PUT') {
$url .= $type . '/' . $file . '?' . http_build_query($this->authParams + $params);
$options['content'] = $content;
$options['header'] = array('Content-Type: application/octet-stream');
} else {
trigger_error(sprintf(self::E_METHODNOTSUPPORTED, $method));
return false;
}
return $this->web->request($url, $options);
}
示例15: ajax_getwidgetnames_GET
function ajax_getwidgetnames_GET(Web $w)
{
$module = $w->request("source");
if (!empty($module)) {
$names = $w->Widget->getWidgetNamesForModule($module);
echo json_encode($names);
}
}