コード例 #1
0
ファイル: printview.php プロジェクト: itillawarra/cmfive
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
0
ファイル: atfile.php プロジェクト: itillawarra/cmfive
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
0
ファイル: attach.php プロジェクト: itillawarra/cmfive
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
0
ファイル: atthumb.php プロジェクト: itillawarra/cmfive
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
0
ファイル: atdel.php プロジェクト: itillawarra/cmfive
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']));
    }
}