mirror of
https://bitbucket.org/jsuto/piler.git
synced 2025-06-13 01:37:02 +02:00
add pdf export support
This commit is contained in:
39
webui/controller/message/bulkpdf.php
Normal file
39
webui/controller/message/bulkpdf.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
|
||||
class ControllerMessageBulkPDF extends Controller {
|
||||
|
||||
public function index(){
|
||||
|
||||
$this->id = "content";
|
||||
$this->template = "message/bulkrestore.tpl";
|
||||
$this->layout = "common/layout-empty";
|
||||
|
||||
$request = Registry::get('request');
|
||||
$db = Registry::get('db');
|
||||
|
||||
$imap_ok = 0;
|
||||
|
||||
$this->load->model('search/search');
|
||||
$this->load->model('search/message');
|
||||
$this->load->model('message/pdf');
|
||||
|
||||
$this->load->model('user/user');
|
||||
$this->load->model('mail/mail');
|
||||
|
||||
$this->load->helper('tcpdf/config/lang/hun');
|
||||
$this->load->helper('tcpdf/tcpdf');
|
||||
|
||||
$this->document->title = $this->data['text_message'];
|
||||
|
||||
if(!isset($this->request->post['idlist']) || $this->request->post['idlist'] == '') { die("no idlist parameter given"); }
|
||||
|
||||
$idlist = $this->model_search_search->check_your_permission_by_id_list(explode(",", $this->request->post['idlist']));
|
||||
|
||||
$this->model_message_pdf->download_files_as_zip($idlist);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -69,6 +69,24 @@ class ControllerMessageView extends Controller {
|
||||
$this->data['message']['tag'] = $this->model_search_message->get_message_tag($this->data['id'], $_SESSION['uid']);
|
||||
$this->data['message']['note'] = $this->model_search_message->get_message_note($this->data['id'], $_SESSION['uid']);
|
||||
|
||||
$this->data['images'] = array();
|
||||
|
||||
foreach($this->data['attachments'] as $a) {
|
||||
if(preg_match("/image/", $a['type'])) {
|
||||
$attachment = $this->model_search_message->get_attachment_by_id($a['id']);
|
||||
$fp = fopen(DIR_BASE . 'tmp/' . $a['id'], "w+");
|
||||
if($fp) {
|
||||
fwrite($fp, $attachment['attachment']);
|
||||
fclose($fp);
|
||||
|
||||
$this->data['images'][] = array(
|
||||
'name' => $a['id']
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->render();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user