diff --git a/Controller/PrintTaskController.php b/Controller/PrintTaskController.php index ebec57c..e79cd41 100644 --- a/Controller/PrintTaskController.php +++ b/Controller/PrintTaskController.php @@ -32,13 +32,14 @@ public function printTask() $dompdf = new Dompdf($options); $dompdf->setBasePath('/var/www/app/'); + if ($this->configModel->get('task2pdf_cjk', 1) == 1) { $layout = 'Task2pdf:printlayout/printlayout_n'; } else { $layout = 'Task2pdf:printlayout/printlayout_cjk'; } $task = $this->getTask(); $subtasks = $this->subtaskModel->getAll($task['id']); $files = $this->taskFileModel->getAllDocuments($task['id']); $commentSortingDirection = $this->userMetadataCacheDecorator->get(UserMetadataModel::KEY_COMMENT_SORTING_DIRECTION, 'ASC'); - $html = $this->helper->layout->app('Task2pdf:printlayout/printlayout', array( + $html = $this->helper->layout->app($layout, array( 'project' => $this->projectModel->getById($task['project_id']), 'comments' => $this->commentModel->getAll($task['id'], $commentSortingDirection), 'subtasks' => $subtasks, diff --git a/Plugin.php b/Plugin.php index 6ed78f7..36d9767 100644 --- a/Plugin.php +++ b/Plugin.php @@ -12,6 +12,7 @@ class Plugin extends Base public function initialize() { $this->template->hook->attach('template:task:sidebar:information', 'task2pdf:print'); + $this->template->hook->attach('template:config:application', 'task2pdf:config/font_toggle'); } public function getClasses() { @@ -34,7 +35,7 @@ public function getPluginAuthor() public function getPluginVersion() { - return '0.0.3'; + return '1.1.0'; } public function getPluginDescription() diff --git a/Template/config/font_toggle.php b/Template/config/font_toggle.php new file mode 100644 index 0000000..7311cca --- /dev/null +++ b/Template/config/font_toggle.php @@ -0,0 +1,4 @@ +
+ form->radio('task2pdf_cjk', 'Normal Font set when creating PDFs' , 1, isset($values['task2pdf_cjk'])&& $values['task2pdf_cjk']==1) ?> + form->radio('task2pdf_cjk', 'CJK Font set when creating PDFs' , 2, isset($values['task2pdf_cjk'])&& $values['task2pdf_cjk']==2) ?> +
diff --git a/Template/printlayout/details.php b/Template/printlayout/details.php index 7fbf9be..0727d5b 100644 --- a/Template/printlayout/details.php +++ b/Template/printlayout/details.php @@ -43,7 +43,9 @@ + 0): ?> dt->datetime($task['date_due']) ?> + @@ -60,7 +62,9 @@ + 0): ?> dt->datetime($task['date_started']) ?> + @@ -77,7 +81,9 @@ + 0): ?> dt->datetime($task['date_creation']) ?> + @@ -94,7 +100,9 @@ + 0): ?> dt->datetime($task['date_modification']) ?> + @@ -105,8 +113,10 @@ - + + 0): ?> dt->datetime($task['date_completed']) ?> + @@ -118,7 +128,9 @@ + 0): ?> dt->datetime($task['date_moved']) ?> + diff --git a/Template/printlayout/printlayout_cjk.php b/Template/printlayout/printlayout_cjk.php new file mode 100644 index 0000000..5a2ed8e --- /dev/null +++ b/Template/printlayout/printlayout_cjk.php @@ -0,0 +1,89 @@ + + + + + + + +
+ + render('Task2pdf:printlayout/details', array( + 'task' => $task, + 'tags' => $tags, + 'project' => $project, + 'editable' => false, + )) ?> + +
+ + + render('Task2pdf:printlayout/description', array( + 'task' => $task, + 'project' => $project, + 'is_public' => true, + )) ?> + + + render('Task2pdf:printlayout/subtasks', array( + 'task' => $task, + 'subtasks' => $subtasks, + 'editable' => false + )) ?> + + + render('Task2pdf:printlayout/files', array( + 'task' => $task, + 'files' => $files, + 'images' => $images + )) ?> + + + render('Task2pdf:printlayout/internal_links', array( + 'task' => $task, + 'links' => $links, + 'project' => $project, + 'editable' => false, + 'is_public' => true, + )) ?> + + + render('Task2pdf:printlayout/comments', array( + 'task' => $task, + 'comments' => $comments, + 'project' => $project, + 'editable' => false, + 'is_public' => true, + )) ?> + + +
+ + + + diff --git a/Template/printlayout/printlayout.php b/Template/printlayout/printlayout_n.php similarity index 95% rename from Template/printlayout/printlayout.php rename to Template/printlayout/printlayout_n.php index fd52061..2b00893 100644 --- a/Template/printlayout/printlayout.php +++ b/Template/printlayout/printlayout_n.php @@ -1,4 +1,4 @@ -
+
render('Task2pdf:printlayout/details', array( 'task' => $task, @@ -50,4 +50,3 @@
- diff --git a/font/DroidSansFallback.ttf b/font/DroidSansFallback.ttf new file mode 100644 index 0000000..8e70e80 Binary files /dev/null and b/font/DroidSansFallback.ttf differ