本文整理汇总了PHP中Web::service方法的典型用法代码示例。如果您正苦于以下问题:PHP Web::service方法的具体用法?PHP Web::service怎么用?PHP Web::service使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Web
的用法示例。
在下文中一共展示了Web::service方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: 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);
}
示例3: 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);
}
}
示例4: atthumb_GET
function atthumb_GET(Web &$w)
{
$p = $w->pathMatch("id", array("w", 150), array("h", 150));
$id = str_replace(".jpg", "", $p['id']);
$attachment = $w->service("File")->getAttachment($id);
require_once 'phpthumb/ThumbLib.inc.php';
$thumb = PhpThumbFactory::create(FILE_ROOT . $attachment->fullpath);
$thumb->resize($p['w'], $p['h']);
//$thumb->adaptiveResize($p['w'], $p['h']);
$thumb->show();
exit;
}
示例5: atdel_GET
function atdel_GET(Web &$w)
{
$p = $w->pathMatch("id", "url");
$att = $w->service("File")->getAttachment($p['id']);
if ($att) {
$w->ctx('attach_id', $att->id);
$w->ctx('attach_table', $att->parent_table);
$w->ctx('attach_table_id', $att->parent_id);
$w->ctx('attach_title', $att->title);
$w->ctx('attach_description', $att->description);
$att->delete();
$w->msg("Attachment deleted.", "/" . str_replace(" ", "/", $p['url']));
} else {
$w->error("Attachment does not exist.", "/" . str_replace(" ", "/", $p['url']));
}
}