当前位置: 首页>>代码示例>>PHP>>正文


PHP Web::pathMatch方法代码示例

本文整理汇总了PHP中Web::pathMatch方法的典型用法代码示例。如果您正苦于以下问题:PHP Web::pathMatch方法的具体用法?PHP Web::pathMatch怎么用?PHP Web::pathMatch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Web的用法示例。


在下文中一共展示了Web::pathMatch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: useredit_POST

/**
 * Handle User Edit form submission
 *
 * @param <type> $w
 */
function useredit_POST(Web &$w)
{
    $w->pathMatch("id");
    $errors = $w->validate(array(array("login", ".+", "Login is mandatory")));
    if ($_REQUEST['password'] && $_REQUEST['password'] != $_REQUEST['password2']) {
        $error[] = "Passwords don't match";
    }
    $user = $w->Auth->getObject("User", $w->ctx('id'));
    if (!$user) {
        $errors[] = "User does not exist";
    }
    if (sizeof($errors) != 0) {
        $w->error(implode("<br/>\n", $errors), "/admin/useredit/" . $w->ctx("id"));
    }
    $user->login = $_REQUEST['login'];
    $user->fill($_REQUEST);
    if ($_REQUEST['password']) {
        $user->setPassword($_REQUEST['password']);
    } else {
        $user->password = null;
    }
    $user->is_admin = isset($_REQUEST['is_admin']) ? 1 : 0;
    $user->is_active = isset($_REQUEST['is_active']) ? 1 : 0;
    $user->update();
    $contact = $user->getContact();
    if ($contact) {
        $contact->fill($_REQUEST);
        $contact->private_to_user_id = null;
        $contact->update();
    }
    $w->callHook("admin", "account_changed", $user);
    $w->msg("User " . $user->login . " updated.", "/admin/users");
}
开发者ID:itillawarra,项目名称:cmfive,代码行数:38,代码来源:useredit.php

示例2: editlookup_POST

function editlookup_POST(Web &$w)
{
    $p = $w->pathMatch("id", "type");
    $err = "";
    if ($_REQUEST['type'] == "") {
        $err = "Please add select a TYPE<br>";
    }
    if ($_REQUEST['code'] == "") {
        $err .= "Please enter a KEY<br>";
    }
    if ($_REQUEST['title'] == "") {
        $err .= "Please enter a VALUE<br>";
    }
    if ($err != "") {
        $w->error($err, "/admin/lookup/?type=" . $p['type']);
    } else {
        $lookup = $w->Admin->getLookupbyId($p['id']);
        if ($lookup) {
            $lookup->fill($_REQUEST);
            $lookup->update();
            $msg = "Lookup Item edited";
        } else {
            $msg = "Could not find item?";
        }
        $w->msg($msg, "/admin/lookup/?type=" . $p['type']);
    }
}
开发者ID:itillawarra,项目名称:cmfive,代码行数:27,代码来源:editlookup.php

示例3: printview_GET

function printview_GET(Web &$w)
{
    $p = $w->pathMatch("table", "id");
    $attachments = $w->service("File")->getAttachments($p['table'], $p['$id']);
    $w->ctx("attachments", $attachments);
    $w->setLayout(null);
}
开发者ID:itillawarra,项目名称:cmfive,代码行数:7,代码来源:printview.php

示例4: 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");
}
开发者ID:itillawarra,项目名称:cmfive,代码行数:25,代码来源:edit.php

示例5: atfile_GET

function atfile_GET(Web &$w)
{
    $p = $w->pathMatch("id");
    $id = str_replace(".jpg", "", $p['id']);
    $attachment = $w->service("File")->getAttachment($id);
    $w->sendFile(FILE_ROOT . $attachment->fullpath);
}
开发者ID:itillawarra,项目名称:cmfive,代码行数:7,代码来源:atfile.php

示例6: deletereport_ALL

function deletereport_ALL(Web &$w)
{
    $p = $w->pathMatch("id");
    // if there is  report ID in the URL ...
    if ($p['id']) {
        // get report details
        $rep = $w->Report->getReportInfo($p['id']);
        // if report exists, delete
        if ($rep) {
            $rep->is_deleted = 1;
            $rep->update();
            // need to check if there is a feed associated with this report
            $feed = $w->Report->getFeedInfobyReportId($rep->id);
            // if feed exists, set is_deleted flag. ie. delete feed as well as report
            if ($feed) {
                $feed->is_deleted = 1;
                $feed->update();
            }
            // return
            $w->msg("Report deleted", "/report/index/");
        } else {
            $w->msg("Report no longer exists?", "/report/index/");
        }
    }
}
开发者ID:itillawarra,项目名称:cmfive,代码行数:25,代码来源:deletereport.php

示例7: delete_ALL

function delete_ALL(Web $w)
{
    $p = $w->pathMatch("id");
    if (empty($p['id'])) {
        $w->error("Group not found", "/admin-groups");
    }
    $group = $w->Auth->getUser($p['id']);
    if (empty($group->id)) {
        $w->error("Group not found", "/admin-groups");
    }
    $group->delete();
    $roles = $group->getRoles();
    if (!empty($roles)) {
        foreach ($roles as $role) {
            $group->removeRole($role);
        }
    }
    $members = $w->Auth->getGroupMembers($option['group_id']);
    if ($members) {
        foreach ($members as $member) {
            $member->delete();
        }
    }
    $w->msg("Group deleted", "/admin-groups");
}
开发者ID:itillawarra,项目名称:cmfive,代码行数:25,代码来源:delete.php

示例8: 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));
}
开发者ID:itillawarra,项目名称:cmfive,代码行数:7,代码来源:get.php

示例9: view_GET

function view_GET(Web &$w)
{
    $p = $w->pathMatch("m", "a");
    // first see if we need to split into sub modules
    $module = $p['m'];
    $action = $p['a'];
    // check if help is allowed for this topic
    if (!$w->Auth->allowed($p['m'] . '/' . $p['a'])) {
        $w->ctx("help_content", "Sorry, there is no help for this topic.");
    }
    $submodule = "";
    // check for submodule
    if (strcontains($p['m'], array("-"))) {
        $ms = explode("-", $p['m']);
        $module = $ms[0];
        $submodule = $ms[1];
    }
    // find a module toc
    $tocf = getHelpFileContent($w, $module, null, $module . "_toc");
    if ($tocf) {
        $w->ctx("module_toc", $module . '/' . $module . "_toc");
        $w->ctx("module_title", HelpLib::extractTitle($tocf));
    }
    // load help file
    $help_file = HelpLib::getHelpFilePath($w, $module, $submodule, $action);
    $content = "Sorry, this help topic is not yet written.";
    if (file_exists($help_file)) {
        $content = file_get_contents($help_file);
    }
    // set context
    $w->ctx("help_content", helpMarkup(pruneRestricted($w, $content), $module));
    $w->ctx("module", $module);
    $w->ctx("submodule", $submodule);
    $w->ctx("action", $action);
}
开发者ID:itillawarra,项目名称:cmfive,代码行数:35,代码来源:view.php

示例10: taskAjaxSelectbyTaskGroup_ALL

function taskAjaxSelectbyTaskGroup_ALL(Web $w)
{
    $p = $w->pathMatch("taskgroup_id");
    $taskgroup = $w->Task->getTaskGroup($p['taskgroup_id']);
    if (empty($taskgroup->id)) {
        return;
    }
    $tasktypes = $taskgroup != "" ? $w->Task->getTaskTypes($taskgroup->task_group_type) : array();
    $priority = $taskgroup != "" ? $w->Task->getTaskPriority($taskgroup->task_group_type) : array();
    $members = $taskgroup != "" ? $w->Task->getMembersBeAssigned($taskgroup->id) : array();
    sort($members);
    $typetitle = $taskgroup != "" ? $taskgroup->getTypeTitle() : "";
    $typedesc = $taskgroup != "" ? $taskgroup->getTypeDescription() : "";
    // if user cannot assign tasks in this group, leave 'first_assignee' blank for owner/member to delegate
    $members = $taskgroup->getCanIAssign() ? $members : array(array("Default", ""));
    // create dropdowns loaded with respective data
    $ttype = Html::select("task_type", $tasktypes, null);
    $prior = Html::select("priority", $priority, null);
    $mem = Html::select("assignee_id", $members, null);
    // first_
    $taskgroup_link = $taskgroup->isOwner($w->Auth->user()) ? "<a href=\"" . $w->localUrl("task-group/viewmembergroup/" . $taskgroup->id) . "\">" . $taskgroup->title . "</a>" : $taskgroup->title;
    $tasktext = "<table style='width: 100%;'>" . "<tr><td class=section colspan=2>Task Group Description</td></tr>" . "<tr><td><b>Task Group</td><td>" . $taskgroup_link . "</td></tr>" . "<tr><td><b>Task Type</b></td><td>" . $typetitle . "</td></tr>" . "<tr valign=top><td><b>Description</b></td><td>" . $typedesc . "</td></tr>" . "</table>";
    // return as array of arrays
    $result = array($ttype, $prior, $mem, $tasktext, Html::select("status", $taskgroup->getTypeStatus(), null, null, null, null));
    $w->setLayout(null);
    $w->out(json_encode($result));
}
开发者ID:itillawarra,项目名称:cmfive,代码行数:27,代码来源:taskAjaxSelectbyTaskGroup.php

示例11: moreInfo_GET

/**
* Display member and permission infomation
*
* @param <type> $w
*/
function moreInfo_GET(Web &$w)
{
    $option = $w->pathMatch("group_id");
    $w->Admin->navigation($w, $w->Auth->getUser($option['group_id'])->login);
    if ($w->Auth->user()->is_admin || $w->Auth->getRoleForLoginUser($option['group_id'], $w->Auth->user()->id) == "owner") {
        $w->ctx("addMember", Html::box("/admin/groupmember/" . $option['group_id'], "New Member", true));
    }
    $w->ctx("editPermission", Html::b("/admin/permissionedit/" . $option['group_id'], "Edit Permissions"));
    //fill in member table;
    $table = array(array("Name", "Role", "Operations"));
    $groupMembers = $w->Auth->getGroupMembers($option['group_id']);
    if ($groupMembers) {
        foreach ($groupMembers as $groupMember) {
            $line = array();
            $style = $groupMember->role == "owner" ? "<div style=\"color:red;\">" : "<div style=\"color:blue;\">";
            $name = $groupMember->getUser()->is_group == 1 ? $groupMember->getUser()->login : $groupMember->getUser()->getContact()->getFullName();
            $line[] = $style . $name . "</div>";
            $line[] = $style . $groupMember->role . "</div>";
            if ($w->Auth->user()->is_admin || $w->Auth->getRoleForLoginUser($option['group_id'], $w->Auth->user()->id) == "owner") {
                $line[] = Html::a("/admin/memberdelete/" . $option['group_id'] . "/" . $groupMember->id, "Delete", null, null, "Are you sure you want to delete this member?");
            } else {
                $line[] = null;
            }
            $table[] = $line;
        }
    }
    $w->ctx("memberList", Html::table($table, null, "tablesorter", true));
}
开发者ID:itillawarra,项目名称:cmfive,代码行数:33,代码来源:moreInfo.php

示例12: editworkentry_POST

function editworkentry_POST(Web $w)
{
    list($workentry_id) = $w->pathMatch("id");
    if (empty($workentry_id)) {
        $w->error("Missing an ID");
    }
    $we = $w->Bend->getWorkEntryForId($workentry_id);
    if (empty($we)) {
        $w->error("No work entry found for this id: " . $workentry_id);
    }
    $we->fill($_POST);
    if (empty($we->user_id)) {
        $we->user_id = $w->Auth->user()->id;
    }
    // now get the category
    if (!empty($_POST['category_3'])) {
        $we->bend_work_category_id = $_POST['category_3'];
    } else {
        if (!empty($_POST['category_2'])) {
            $we->bend_work_category_id = $_POST['category_2'];
        } else {
            if (!empty($_POST['category_1'])) {
                $we->bend_work_category_id = $_POST['category_1'];
            }
        }
    }
    // TODO check work period, etc.
    $we->update();
    $w->msg("Work hours recorded", "/bend-workhours/list");
}
开发者ID:careck,项目名称:bendms,代码行数:30,代码来源:editworkentry.php

示例13: list_GET

function list_GET(Web $w)
{
    History::add("List Workhours");
    list($userid, $periodid) = $w->pathMatch("a", "b");
    // get the user
    if (!empty($userid)) {
        $user = $w->Auth->getUser($userid);
    } else {
        $user = $w->Auth->user();
    }
    // calculate total work hours for this period
    $workentries = $w->Bend->getWorkhoursForUser($user, $periodid);
    $total_worked = 0;
    $total_accredited = 0;
    if (!empty($workentries)) {
        foreach ($workentries as $we) {
            $total_worked += $we->hours;
            if ($we->user_id == $we->attributed_user_id) {
                $total_accredited += $we->hours;
            }
        }
    }
    $w->ctx("total_worked", $total_worked);
    $w->ctx("total_accredited", $total_accredited);
    $w->ctx("user", $user);
    $w->ctx("workentries", $workentries);
    $w->ctx("workPeriod", $w->Bend->getWorkPeriodForId($periodid));
    $w->ctx("allWorkPeriods", $w->Bend->getAllWorkPeriods());
}
开发者ID:careck,项目名称:bendms,代码行数:29,代码来源:list.php

示例14: groupedit_POST

function groupedit_POST(Web $w)
{
    $option = $w->pathMatch("group_id");
    $user = $w->Auth->getUser($option['group_id']);
    $user->login = $_REQUEST['title'];
    $user->update();
    $w->msg("Group info updated!", "/admin/groups");
}
开发者ID:itillawarra,项目名称:cmfive,代码行数:8,代码来源:groupedit.php

示例15: media_GET

/**
* Send media files from within
* a modules help/media folder
*
* @param unknown_type $w
*/
function media_GET(Web &$w)
{
    $p = $w->pathMatch("m", "f");
    $m = $p['m'];
    $f = $p['f'];
    $filename = str_replace("..", "", ROOT . "/" . $w->getModuleDir($m) . '/help/media/' . $f);
    $w->sendFile($filename);
}
开发者ID:itillawarra,项目名称:cmfive,代码行数:14,代码来源:media.php


注:本文中的Web::pathMatch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。