1<?php 2/** 3 * DokuWiki Plugin acknowledge (Helper Component) 4 * 5 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html 6 * @author Andreas Gohr, Anna Dabrowska <dokuwiki@cosmocode.de> 7 */ 8 9 10class helper_plugin_acknowledge extends DokuWiki_Plugin 11{ 12 13 /** 14 * @return helper_plugin_sqlite|null 15 */ 16 public function getDB() 17 { 18 /** @var \helper_plugin_sqlite $sqlite */ 19 $sqlite = plugin_load('helper', 'sqlite'); 20 if ($sqlite === null) { 21 msg($this->getLang('error sqlite plugin missing'), -1); 22 return null; 23 } 24 if (!$sqlite->init('acknowledgement', __DIR__ . '/db')) { 25 return null; 26 } 27 28 return $sqlite; 29 } 30 31 /** 32 * @param string $page Page ID 33 * @param string $assignees comma separated list of users and groups 34 */ 35 public function setAssignees($page, $assignees) 36 { 37 $sqlite = $this->getDB(); 38 if (!$sqlite) return; 39 40 $sql = "REPLACE INTO assignments ('page', 'assignee') VALUES (?,?)"; 41 $sqlite->query($sql, $page, $assignees); 42 } 43 44 45} 46 47