1<?php 2 3namespace dokuwiki\plugin\bez\mdl; 4 5 6class Model { 7 /** @var \helper_plugin_sqlite */ 8 protected $sqlite; 9 10 /** @var \SQLite3 */ 11 protected $db; 12 13 /** @var Acl */ 14 protected $acl; 15 16 protected $dw_auth, $user_nick, $action, $conf; 17 18 /** @var ThreadFactory */ 19 protected $threadFactory; 20 21 /** @var UserFactory */ 22 protected $userFactory; 23 24 /** @var LabelFactory */ 25 protected $labelFactory; 26 27 /** @var Thread_commentFactory */ 28 protected $thread_commentFactory; 29 30 /** @var TaskFactory */ 31 protected $taskFactory; 32 33 /** @var Task_programFactory */ 34 protected $task_programFactory; 35 36 /** @var Task_commentFactory */ 37 protected $task_commentFactory; 38 39 /** @var Authentication_tokenFactory */ 40 protected $authentication_tokenFactory; 41 42 public function __get($property) { 43 $models = array('userFactory', 'threadFactory', 'labelFactory', 'thread_commentFactory', 'taskFactory', 'task_programFactory', 'task_commentFactory', 'authentication_tokenFactory'); 44 if (in_array($property, $models) || 45 in_array($property, array('sqlite', 'db', 'acl', 'dw_auth', 'user_nick', 'action', 'conf'))) { 46 return $this->$property; 47 } 48 } 49 50 public function __construct($dw_auth, $user_nick, $action, $conf) { 51 $this->dw_auth = $dw_auth; 52 $this->user_nick = $user_nick; 53 $this->action = $action; 54 $this->conf = $conf; 55 56 $this->db_helper = plugin_load('helper', 'bez_db'); 57 58 $this->sqlite = $this->db_helper->getDB(); 59 $this->db = $this->sqlite->getAdapter()->getDb(); 60 $this->db->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); 61 62 $this->acl = new Acl($this); 63 64 $this->userFactory = new UserFactory($this); 65 66 $this->threadFactory = new ThreadFactory($this); 67 68 $this->labelFactory = new LabelFactory($this); 69 70 $this->thread_commentFactory = new Thread_commentFactory($this); 71 72 $this->taskFactory = new TaskFactory($this); 73 74 $this->task_programFactory = new Task_programFactory($this); 75 76 $this->task_commentFactory = new Task_commentFactory($this); 77 78 $this->authentication_tokenFactory = new Authentication_tokenFactory($this); 79 } 80} 81