Lines Matching refs:this

50             return $this->$property;
56 if ($this->coordinator === $this->model->user_nick ||
57 $this->model->get_level() >= BEZ_AUTH_ADMIN) {
66 $this->validator->set_rules(array(
74 if ($this->id === NULL) {
75 $this->original_poster = $this->model->user_nick;
76 $this->create_date = date('c');
77 $this->last_activity_date = $this->create_date;
78 $this->last_modification_date = $this->create_date;
80 $this->state = 'proposal';
82 $this->acl->grant('title', BEZ_PERMISSION_CHANGE);
83 $this->acl->grant('content', BEZ_PERMISSION_CHANGE);
84 $this->acl->grant('type', BEZ_PERMISSION_CHANGE);
87 if ($this->model->get_level() >= BEZ_AUTH_LEADER) {
89 $this->state = 'opened';
91 $this->acl->grant('coordinator', BEZ_PERMISSION_CHANGE);
92 $this->acl->grant('label_id', BEZ_PERMISSION_CHANGE);
93 $this->acl->grant('private', BEZ_PERMISSION_CHANGE);
98 if ($this->model->level < BEZ_AUTH_ADMIN && $this->private == '1') {
99 if ($this->get_participant($this->model->user_nick) === false) {
100 $this->acl->revoke(self::get_select_columns(), BEZ_AUTH_LEADER);
105 if ($this->state == 'proposal' && $this->original_poster == $this->model->user_nick) {
106 $this->acl->grant('title', BEZ_PERMISSION_CHANGE);
107 $this->acl->grant('content', BEZ_PERMISSION_CHANGE);
108 $this->acl->grant('type', BEZ_PERMISSION_CHANGE);
111 if ($this->coordinator == $this->model->user_nick) {
112 $this->acl->grant('title', BEZ_PERMISSION_CHANGE);
113 $this->acl->grant('content', BEZ_PERMISSION_CHANGE);
114 $this->acl->grant('coordinator', BEZ_PERMISSION_CHANGE);
115 $this->acl->grant('label_id', BEZ_PERMISSION_CHANGE);
116 $this->acl->grant('private', BEZ_PERMISSION_CHANGE);
118 $this->acl->grant('state', BEZ_PERMISSION_CHANGE);
119 $this->acl->grant('type', BEZ_PERMISSION_CHANGE);
127 if (isset($data['coordinator']) && $this->state == 'proposal') {
128 $this->state = 'opened';
132 $this->purge();
135 $this->last_modification_date = date('c');
136 $this->last_activity_date = $this->last_modification_date;
140 if ($this->acl_of('state') < BEZ_PERMISSION_CHANGE) {
149 if ($state == $this->state) {
154 $this->state = $state;
155 $this->closed_by = $this->model->user_nick;
156 $this->close_date = date('c');
158 $this->model->sqlite->query("UPDATE {$this->get_table_name()} SET state=?, closed_by=?, close_date=? WHERE id=?",
160 $this->closed_by,
161 $this->close_date,
162 $this->id);
165 $this->state = $state;
167 $this->model->sqlite->query("UPDATE {$this->get_table_name()} SET state=? WHERE id=?", $state, $this->id);
170 $this->state = $state;
179 if ($private == $this->private) {
184 $this->model->sqlite->query("UPDATE {$this->get_table_name()} SET private=? WHERE id=?", $private, $this->id);
187 $this->model->sqlite->query("UPDATE task SET private=? WHERE thread_id=?", $private, $this->id);
191 $this->last_activity_date = date('c');
192 $this->model->sqlite->query('UPDATE thread SET last_activity_date=? WHERE id=?',
193 $this->last_activity_date, $this->id);
197 if ($this->id === NULL) {
211 $r = $this->model->sqlite->query($sql, $this->id);
212 $pars = $this->model->sqlite->res2arr($r);
222 if ($this->id === NULL) {
230 $r = $this->model->sqlite->query($q, $this->id, $user_id);
231 $par = $this->model->sqlite->res2row($r);
241 $user_id = $this->model->user_nick;
243 $par = $this->get_participant($user_id);
252 if ($this->id === NULL) {
256 $participant = $this->get_participant($user_id, true);
269 $this->model->sqlite->query($sql, $this->id, $user_id);
275 if ($this->id === NULL) {
280 if (!$this->model->userFactory->exists($user_id)) {
289 $participant = $this->get_participant($user_id, true);
293 $participant['thread_id'] = $this->id;
295 $participant['added_by'] = $this->model->user_nick;
300 $this->model->sqlite->storeEntry('thread_participant', $values);
309 $this->model->sqlite->query($q, $this->id, $user_id);
316 if ($this->id === NULL) {
320 $participant = $this->get_participant($user_id);
334 $this->model->sqlite->query($q, $this->id, $user_id);
339 $this->set_participant_flags($client, array('subscribent'));
340 $this->mail_notify_invite($client);
345 if ($this->id === NULL) {
350 $r = $this->model->sqlite->query('SELECT * FROM label JOIN thread_label ON label.id = thread_label.label_id
351 WHERE thread_label.thread_id=?', $this->id);
352 $arr = $this->model->sqlite->res2arr($r);
362 if ($this->id === NULL) {
366 $r = $this->model->sqlite->query('SELECT id FROM label WHERE id=?', $label_id);
367 $label_id = $this->model->sqlite->res2single($r);
373 $this->model->sqlite->storeEntry('thread_label',
374 array('thread_id' => $this->id,
381 if ($this->id === NULL) {
386 $r = $this->model->sqlite->query('DELETE FROM thread_label WHERE thread_id=? AND label_id=?',$this->id, $label_id);
388 throw new \Exception('label was not assigned to this thread');
394 $r = $this->model->sqlite->query("SELECT id FROM thread_comment WHERE (type='cause' OR type='risk' OR type='opportunity') AND thread_id=?",
395 $this->id);
396 $arr = $this->model->sqlite->res2arr($r);
406 return in_array($this->state, array('proposal', 'opened', 'done'));
410 return $this->type == 'issue' && in_array($this->state, array('opened', 'done'));
414 return in_array($this->state, array('opened', 'done'));
418 return in_array($this->state, array('opened', 'done'));
422 $res = $this->model->sqlite->query("SELECT state FROM task WHERE thread_id = ?
424 AND state = 'opened'", $this->id);
425 return $this->model->sqlite->res2count($res);
429 $res = $this->model->sqlite->query("SELECT thread_comment.id FROM thread_comment
432 thread_comment.type = 'cause' AND task.id IS NULL", $this->id);
433 $causes_without_tasks = $this->model->sqlite->res2count($res);
435 return !in_array($this->state, array('closed', 'rejected'))
436 && $this->task_count > 0
437 && $this->count_opened_nopreventive_tasks() == 0
442 return $this->state != 'rejected' && $this->task_count == 0;
446 return in_array($this->state, array('closed', 'rejected'));
450 $r = $this->model->thread_commentFactory->get_from_thread($this, array(), 'id DESC', 1);
457 $tpl = $this->model->action->get_tpl();
458 return $tpl->url('thread', 'id', $this->id);
462 return '#' . $this->id;
467 return parent::getMailSubject() . ' #'.$this->id. ' ' .$this->title;
471 $tpl = $this->model->action->get_tpl();
479 $old_content_html = $this->content_html;
480 $this->content_html = p_render('bez_xhtmlmail', p_get_instructions($this->content), $info);
483 $tpl->set('thread', $this);
486 $thread_box = $this->model->action->bez_tpl_include('thread_box', true);
488 $this->content_html = $old_content_html;
494 $tpl = $this->model->action->get_tpl();
496 $thread_box = $this->mail_thread_box($attachedImages);
499 $content = $this->model->action->bez_tpl_include('mail/thread', true);
508 $tpl = $this->model->action->get_tpl();
510 $tpl->set('who', $this->model->user_nick);
513 $content = $this->mail_thread($attachedImages);
514 $this->mail_notify($content, false, $attachedImages);
518 $tpl = $this->model->action->get_tpl();
520 $tpl->set('who', $this->model->user_nick);
523 $content = $this->mail_thread($attachedImages);
524 $this->mail_notify($content, array($client), $attachedImages);
528 $tpl = $this->model->action->get_tpl();
530 $tpl->set('who', $this->model->user_nick);
533 $content = $this->mail_thread($attachedImages);
534 $this->mail_notify($content, array($this->coordinator), $attachedImages);
538 $tpl = $this->model->action->get_tpl();
540 $tpl->set('who', $this->model->user_nick);
543 $content = $this->mail_thread($attachedImages);
544 $this->mail_notify($content, $this->model->userFactory->users_of_group(array('admin', 'bez_admin')), $attachedImages);
548 $tpl = $this->model->action->get_tpl();
550 $tpl->set('who', $this->model->user_nick);
553 $content = $this->mail_thread($attachedImages);
554 $this->mail_notify($content, $users, $attachedImages);
558 $tpl = $this->model->action->get_tpl();
561 $tpl->set('who', $this->model->user_nick);
566 $tpl->set('thread', $this);
568 $content = $this->model->action->bez_tpl_include('mail/thread', true);
570 $this->mail_notify($content, false, $attachedImages);
574 $tpl = $this->model->action->get_tpl();
583 $tpl->set('who', $this->model->user_nick);
588 $tpl->set('thread', $this);
590 $content = $this->model->action->bez_tpl_include('mail/thread', true);
592 $this->mail_notify($content, false, $attachedImages);
596 $r = $this->model->sqlite->query("SELECT COUNT(*) FROM thread_comment WHERE thread_id=?",
597 $this->id);
598 $comments_count = $this->model->sqlite->res2single($r);
599 return $this->task_count == 0 && $comments_count == 0;