本文整理汇总了PHP中Web::msg方法的典型用法代码示例。如果您正苦于以下问题:PHP Web::msg方法的具体用法?PHP Web::msg怎么用?PHP Web::msg使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Web
的用法示例。
在下文中一共展示了Web::msg方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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/");
}
}
}
示例2: deletelookup_ALL
function deletelookup_ALL(Web &$w)
{
$p = $w->pathMatch("id", "type");
$lookup = $w->Admin->getLookupbyId($p['id']);
if ($lookup) {
$arritem['is_deleted'] = 1;
$lookup->fill($arritem);
$lookup->update();
$w->msg("Lookup Item deleted", "/admin/lookup/?type=" . $p['type']);
} else {
$w->msg("Lookup Item not found?", "/admin/lookup/?type=" . $p['type']);
}
}
示例3: 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");
}
示例4: 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']);
}
}
示例5: 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");
}
示例6: composer_ALL
function composer_ALL(Web $w)
{
echo "<pre>" . file_get_contents(ROOT_PATH . '/log/composer.log') . "</pre>";
// Collect dependencies
$dependencies_array = array();
foreach ($w->modules() as $module) {
$dependencies = Config::get("{$module}.dependencies");
if (!empty($dependencies)) {
$dependencies_array = array_merge($dependencies, $dependencies_array);
}
}
$json_obj = array();
$json_obj["config"] = array();
$json_obj["config"]["vendor-dir"] = 'composer/vendor';
$json_obj["config"]["cache-dir"] = 'composer/cache';
$json_obj["config"]["bin-dir"] = 'composer/bin';
$json_obj["require"] = $dependencies_array;
// Need to change dir so composer can find the json file
chdir(SYSTEM_PATH);
// Create the JSON file
file_put_contents(SYSTEM_PATH . "/composer.json", json_encode($json_obj, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_FORCE_OBJECT));
//Create the commands
$input = new ArrayInput(array('command' => 'update', '--prefer-dist' => 'true'));
$filestream = new StreamOutput(fopen(ROOT_PATH . '/log/composer.log', 'w'));
//Create the application and run it with the commands
$application = new Application();
$exitcode = $application->run($input, $filestream);
// Change dir back to root
chdir(ROOT_PATH);
// This doesn't happen for some reason
$w->msg("Composer update return exit code " . $exitcode . " (0 is OK)<br/>Check the /log/composer.log for output", "/admin");
}
示例7: deletemember_POST
function deletemember_POST(Web &$w)
{
$p = $w->pathMatch("report_id", "user_id");
// get the details of the person to delete
$member = $w->Report->getReportMember($p['report_id'], $p['user_id']);
$_POST['id'] = $member->id;
// if member exists, delete them
if ($member) {
$member->fill($_POST);
$member->update();
$w->msg("Member deleted", "/report/viewreport/" . $p['report_id'] . "?tab=2");
} else {
// if member somehow no longer exists, say as much
$w->msg("Member no longer exists?", "/report/edit/" . $p['report_id'] . "?tab=2");
}
}
示例8: attach_POST
function attach_POST(Web &$w)
{
$table = $w->request('table');
$id = $w->request('id');
$title = $w->request('title');
$description = $w->request('description');
$type_code = $w->request('type_code');
$url = str_replace(" ", "/", $w->request('url'));
$object = $w->Auth->getObject($table, $id);
if (!$object) {
$w->error("Nothing to attach to.", $url);
}
$aid = $w->service("File")->uploadAttachment("file", $object, $title, $description, $type_code);
if ($aid) {
$w->ctx('attach_id', $aid);
$w->ctx('attach_table', $table);
$w->ctx('attach_table_id', $id);
$w->ctx('attach_title', $title);
$w->ctx('attach_description', $description);
$w->ctx('attach_type_code', $type_code);
$w->msg("File attached.", $url);
} else {
$w->error("There was an error. Attachment could not be saved.", $url);
}
}
示例9: 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");
}
示例10: 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");
}
示例11: 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");
}
示例12: edit_POST
function edit_POST(Web $w)
{
$p = $w->pathMatch("id");
$report_template = !empty($p['id']) ? $w->Report->getReportTemplate($p['id']) : new ReportTemplate($w);
$report_template->fill($_POST);
$response = $report_template->insertOrUpdate();
$w->msg("Report template " . (!empty($p['id']) ? "updated" : "created"), "/report/edit/{$report_template->report_id}#templates");
}
示例13: groupadd_POST
function groupadd_POST(Web $w)
{
$user = new User($w);
$user->login = $_REQUEST['title'];
$user->is_group = 1;
$user->insert();
$w->msg("New group added!", "/admin/groups");
}
示例14: editmember_POST
function editmember_POST(Web &$w)
{
$p = $w->pathMatch("id");
$member = $w->Report->getReportMember($_POST['report_id'], $p['id']);
$member->fill($_REQUEST);
$member->update();
$w->msg("Member updated", "/report/edit/" . $_POST['report_id'] . "#members");
}
示例15: memberdelete_GET
function memberdelete_GET(Web &$w)
{
$option = $w->pathMatch("group_id", "member_id");
$member = $w->Auth->getGroupMemberById($option['member_id']);
if ($member) {
$member->delete();
}
$w->msg("Member is deleted!", "/admin/moreInfo/" . $option['group_id']);
}