Lines Matching +full:pr +full:- +full:inactive +full:- +full:days

34 		return (bool) $this->getDb();
44 if($this->db === null) {
45 $this->db = plugin_load('helper', 'sqlite');
46 if($this->db === null) {
47 msg('The timetrack plugin needs the sqlite plugin', -1);
50 if(!$this->db->init('timetrack', dirname(__FILE__) . '/db/')) {
51 $this->db = null;
56 return $this->db;
64 $sqlite = $this->getDb();
67 $res = $sqlite->query("SELECT id FROM user WHERE user = ?", $user);
68 $db_user_id = (int) $sqlite->res2single($res);
69 $sqlite->res_close($res);
72 $sqlite->query('INSERT OR IGNORE INTO user (user) VALUES (?)', $user);
74 $res = $sqlite->query("SELECT id FROM user WHERE user = ?", $user);
75 $db_user_id = (int) $sqlite->res2single($res);
76 $sqlite->res_close($res);
89 $sqlite = $this->getDb();
91 $res = $sqlite->query("SELECT id FROM page WHERE page = ?", $page);
92 $page_id = (int) $sqlite->res2single($res);
95 $sqlite->query('INSERT OR IGNORE INTO page(page) VALUES (?)',$page);
102 $res = $sqlite->query("SELECT id FROM page WHERE page = ?", $page);
103 $page_id = (int) $sqlite->res2single($res);
117 $sqlite = $this->getDb();
122 $page_id = $this->getPageId($pageid);
125 …$res = $sqlite->query('INSERT OR IGNORE INTO project (page_id, abbr) VALUES (?,?)', $page_id, $abb…
128 $res = $sqlite->query("SELECT id FROM project WHERE page_id = ? AND abbr = ?", $page_id, $abbr);
129 $project_id = (int) $sqlite->res2single($res);
130 $sqlite->res_close($res);
133 msg("timetrack plugin: failed saving project", -1);
137 …$sqlite->query("UPDATE project SET name = ?, `from` = ?, `to` = ? WHERE id = ?", $name, $from, $to…
139 $task_id = $this->updateTask($project_id,$abbr,$name);
155 $sqlite = $this->getDb();
157 …$res = $sqlite->query('INSERT OR IGNORE INTO task (project_id,abbr,active) VALUES (?,?,1)',$projec…
159 $res = $sqlite->query("SELECT id FROM task WHERE project_id = ? AND abbr = ?", $project_id,$abbr);
160 $task_id = (int) $sqlite->res2single($res);
161 $sqlite->res_close($res);
164 msg("timetrack plugin: failed saving task", -1);
168 $sqlite->query("UPDATE task SET name = ?, active = 1 WHERE id = ?", $name, $task_id);
175 * set all tasks not in array to inactive
181 $sqlite = $this->getDb();
183 $task_abbrs = $sqlite->quote_and_join($task_abbrs);
185 $sqlite->query("UPDATE task SET active = 0
199 $sqlite = $this->getDb();
201 …$sqlite->query('UPDATE user_time SET value = ?, update_time = ? WHERE id = ?', $value, time(), $us…
214 $sqlite = $this->getDb();
216 …$sqlite->query('INSERT INTO user_time (update_time,user_id,task_id, date, value) VALUES (?,?,?,?,?…
218 $this->getUserIdByName($user),
238 $sqlite = $this->getDb();
243 $page_id = $this->getPageId($pageid);
246 $res = $sqlite->query("SELECT id FROM project WHERE page_id = ? AND abbr = ?", $page_id, $abbr);
247 $project_id = (int) $sqlite->res2single($res);
248 $sqlite->res_close($res);
251 msg("timetrack plugin: failed loading project", -1);
258 $sqlite = $this->getDb();
260 $res = $sqlite->query("SELECT
263 JOIN project pr ON pa.id=pr.page_id
265 pr.id = ?",
267 $data = $sqlite->res2single($res);
273 $sqlite = $this->getDb();
275 $res = $sqlite->query("SELECT
276 pr.name project_name,
277 pr.abbr project_abbr,
282 JOIN project pr ON pa.id=pr.page_id
283 JOIN task t ON pr.id=t.project_id
287 $data = $sqlite->res2arr($res);
293 $sqlite = $this->getDb();
295 $res = $sqlite->query("SELECT pr.id
297 JOIN project pr on pa.id=pr.page_id
301 $data = $sqlite->res2arr($res);
309 $sqlite = $this->getDb();
311 $res = $sqlite->query("SELECT
313 FROM project AS pr
315 pr.id = ?",
317 $data = $sqlite->res2row($res);
324 $sqlite = $this->getDb();
326 if($daterange === null) $daterange = $this->getDateRangeByYearWeek();
328 $res = $sqlite->query("SELECT
341 $this->getUserIdByName($user),
344 $data = $sqlite->res2arr($res);
356 $sqlite = $this->getDb();
358 $res = $sqlite->query('SELECT
361 JOIN project pr on pa.id=pr.page_id
362 JOIN task t on pr.id=t.project_id
365 $db_id = (int) $sqlite->res2single($res);
366 $sqlite->res_close($res);
374 $sqlite = $this->getDb();
377 $user = $this->getCurrentUser();
380 $res = $sqlite->query("SELECT u.id
384 $db_user_id = (int) $sqlite->res2single($res);
385 $sqlite->res_close($res);
390 $sqlite = $this->getDb();
392 if($daterange === null) $daterange = $this->getDateRangeByYearWeek();
394 $res = $sqlite->query("SELECT
395 pr.name project_name,
396 pr.id project_id,
403 JOIN project pr ON pa.id=pr.page_id
404 JOIN task t ON pr.id=t.project_id
410 $this->getUserIdByName($user),
413 $data = $sqlite->res2arr($res);
419 $sqlite = $this->getDb();
421 if($daterange === null) $daterange = $this->getDateRangeByYearWeek();
423 $res = $sqlite->query("SELECT
432 $this->getUserIdByName($user),
435 $data = $sqlite->res2arr($res);
447 $sqlite = $this->getDb();
449 $res = $sqlite->query("SELECT
450 pr.name project_name,
453 FROM project AS pr
454 JOIN task t ON pr.id=t.prpject_id
458 $data = $sqlite->res2row($res);
464 $sqlite = $this->getDb();
466 $res = $sqlite->query("SELECT
472 ut.task_id NOT IN (".$sqlite->quote_and_join($task_ids).")",
473 $this->getUserIdByName($user),
475 $data = $sqlite->res2single($res);
483 $data = $this->getUserData($user,$daterange);
494 $sqlite = $this->getDb();
502 $cond_project = " pr.id IN (".$sqlite->quote_and_join($project_ids).") AND ";
506 $res = $sqlite->query("SELECT
507 pr.id project_id,
508 pr.name project_name,
515 JOIN project pr ON pa.id=pr.page_id
516 JOIN task t ON pr.id=t.project_id
523 $this->getUserIdByName($user),
526 $data = $sqlite->res2arr($res);
538 $sqlite = $this->getDb();
546 $cond_project = " pr.id IN (".$sqlite->quote_and_join($project_ids).") AND ";
550 $res = $sqlite->query("SELECT
551 pr.name project_name,
554 pr.id project_id
556 JOIN project pr ON pa.id=pr.page_id
557 JOIN task t ON pr.id=t.project_id
561 ORDER BY pr.name,t.name");
562 $taskdata = $sqlite->res2arr($res);
568 $sqlite = $this->getDb();
574 $days = $this->getConf('days_recent_project_active');
575 if($days < 1) $days = 1;
576 if($days > 200) $days = 200;
577 $interval = new DateInterval("P{$days}D");
579 $res = $sqlite->query("SELECT
580 pr.name project_name,
583 pr.id project_id
585 JOIN project pr on pa.id = pr.page_id
586 JOIN task t ON pr.id=t.project_id
593 ORDER BY pr.name,t.name",
594 $this->getUserIdByName($user),
595 $start->sub($interval)->format('Y-m-d'),
596 $end->add($interval)->format('Y-m-d'));
597 $data = $sqlite->res2arr($res);
603 $sqlite = $this->getDb();
606 $res = $sqlite->query("SELECT
607 pr.id project_id,
608 pr.name project_name,
614 JOIN project pr on pa.id = pr.page_id
615 JOIN task t ON pr.id=t.project_id
620 ORDER BY pr.name,t.name,us.user");
621 $data = $sqlite->res2arr($res);
632 $sqlite = $this->getDb();
634 $res = $sqlite->query("SELECT
635 pr.name project_name,
638 …%Y', date(ut.date, '-3 days', 'weekday 4')) || substr('00'||((strftime('%j', date(ut.date, '-3 day…
640 FROM project pr
641 JOIN task t on pr.id = t.project_id
644 pr.id = ?
648 $data = $sqlite->res2arr($res);
658 $sqlite = $this->getDb();
660 $res = $sqlite->query("SELECT
663 FROM project pr
664 JOIN task t on pr.id = t.project_id
667 pr.id = ?",
669 $data = $sqlite->res2row($res);
676 $sqlite = $this->getDb();
678 $res = $sqlite->query("SELECT
681 JOIN project pr on pa.id=pr.page_id
682 JOIN task t on pr.id = t.project_id
687 $data = $sqlite->res2single($res);
693 $sqlite = $this->getDb();
695 $res = $sqlite->query("SELECT
698 JOIN project pr on pa.id=pr.page_id
699 JOIN task t on pr.id = t.project_id
704 $data = $sqlite->res2single($res);
718 'overview' => $this->getLang('overview'),
719 'recent' => $this->getLang('recent'),
721 if(auth_quickaclcheck($pageid) > AUTH_NONE && $this->isPageTracked($pageid)) {
722 $tabs['current'] = $this->getLang('current page');
729 $html = '<div id="timetrack-dialog-tabs"><ul>';
732 …$html .= '<li data-tabid="'.$tabid.'"><a href="#timetrack-tab-'.$tabid.'" '.($tabid===$currenttab?…
734 $html .= '</ul><div id="timetrack-tab-'.$currenttab.'">';
743 'id'=>'timetrack-form'
753 $form->setHiddenField('yearweek', $daterange['yearweek']);
754 $form->setHiddenField('call', 'plugin_timetrack');
755 $form->setHiddenField('cmd', 'overview');
756 $form->setHiddenField('pageid',$pageid);
759 …$form->addButton('back', sprintf('<< [KW%s]',$dateStart->sub($dateIntervalWeek)->format('W')))->va…
760 $form->addButton('today', $this->getLang('today') . ' [KW'. date('W') . ']')->val(date('YW'));
761 …$form->addButton('forward', sprintf('>> [KW%s]',$dateEnd->add($dateIntervalWeek)->format('W')))->v…
762 $html = $form->toHTML();
763 $html .= '<h3>KW'.$dateStart->add($dateIntervalWeek)->format('W') . '</h3>';
766 $r->table_open();
767 $r->tablerow_open();
768 $r->tableheader_open();
769 $r->cdata($this->getLang('date'));
770 $r->tableheader_close();
771 $r->tableheader_open();
772 $r->cdata($this->getLang('hours'));
773 $r->tableheader_close();
774 $r->tablerow_close();
776 $data = $this->getOverviewData($user, $daterange);
780 $dateText = $date->format("Y-m-d");
782 $r->tablerow_open();
783 $r->tablecell_open();
784 $r->cdata($dateText);
785 $r->tablecell_close();
786 $r->tablecell_open();
787 $r->cdata((int)$data[$dateText]['value']);
788 $r->tablecell_close();
789 $r->tablerow_close();
795 $r->tablerow_open();
796 $r->tableheader_open();
797 $r->cdata($this->getLang('sum'));
798 $r->tableheader_close();
799 $r->tableheader_open();
800 $r->cdata($sum);
801 $r->tableheader_close();
802 $r->tablerow_close();
804 $r->table_close();
805 $html .= $r->doc;
812 'id'=>'timetrack-form'
823 $weekData = $this->getOverviewData($this->getCurrentUser(), $daterange);
825 $form->setHiddenField('yearweek', $daterange['yearweek']);
826 $form->setHiddenField('call', 'plugin_timetrack');
827 $form->setHiddenField('cmd', $cmd);
828 $form->setHiddenField('pageid',$pageid);
831 …$form->addButton('back', sprintf('<< [KW%s]',$dateStart->sub($dateIntervalWeek)->format('W')))->va…
832 $form->addButton('today', $this->getLang('today') . ' [KW'. date('W') . ']')->val(date('YW'));
833 …$form->addButton('forward', sprintf('>> [KW%s]',$dateEnd->add($dateIntervalWeek)->format('W')))->v…
834 $form->addHTML('<h3>KW'.$dateStart->add($dateIntervalWeek)->format('W') . '</h3>');
835 $form->addTagOpen('table');
836 $form->addTagOpen('tr');
837 $form->addTagOpen('th');
838 $form->addHTML($this->getLang('project'));
839 $form->addTagClose('th');
840 $form->addTagOpen('th');
841 $form->addHTML($this->getLang('task'));
842 $form->addTagClose('th');
844 $dateName = $this->getLang('Abbr_' . $date->format('l')) .'<br>'. $date->format("d.m.");
845 $form->addTagOpen('th');
846 $form->addHTML($dateName);
847 $form->addTagClose('th');
849 $form->addTagClose('tr');
851 $project_counts = $this->countIndexValue($dbUserProjects, 'project_id');
858 $projectDetails = $this->getProjectDetails($project_id);
860 $form->addTagOpen('tr');
863 $form->addElement(new TagOpenElement('th',array(
866 $form->addLabel($task['project_name']);
867 $form->addTagClose('th');
870 $form->addTagOpen('td');
871 $form->addLabel($task['task_name']);
872 $form->addTagClose('td');
874 $dateText = $date->format("Y-m-d");
888 $form->addTagOpen('td');
889 $el = $form->addTextInput("UserTime[$project_id][$task_id][$dateText]",'')
890 ->attr('size',2)
891 ->attr('data-date',$dateText)
892 ->useInput(false);
894 if(($projectDetails['from'] && $projectDetails['from'] > $date->getTimestamp()) ||
895 ($projectDetails['to'] && $projectDetails['to'] < $date->getTimestamp())) {
896 $el->attr('readonly','readonly');
899 $el->val($dateValue);
900 $form->addTagClose('td');
903 $form->addTagClose('tr');
908 $form->addTagOpen('tr');
909 $form->addTag('td')->attr('colspan',2);
910 $form->addTag('td');
911 $form->addTag('td');
912 $form->addTag('td');
913 $form->addTag('td');
914 $form->addTag('td');
915 $form->addTagClose('tr');
916 $form->addTagOpen('tr');
917 $form->addTagOpen('td')->attr('colspan',2);
918 $form->addHTML($this->getLang('sum_day_all'));
919 $form->addTagClose('td');
922 $dateText = $date->format("Y-m-d");
923 $form->addTagOpen('th')->attrs(array(
924 'data-otherhours' => ($weekData[$dateText]['value'] - $date_sum_db[$dateText]),
925 'data-date' => $dateText
928 …$form->addHTML($date_sum_user[$dateText] + $weekData[$dateText]['value'] - $date_sum_db[$dateText]…
929 $form->addTagClose('th');
931 $form->addTagClose('tr');
933 $form->addTagClose('table');
935 return $form->toHTML();
958 $pageid = $this->getPageByProjectId($project_id);
987 if($date === null) $date = date('Y-m-d');
989 …$res['start'] = date('N', $dt)==1 ? date('Y-m-d', $dt) : date('Y-m-d', strtotime('last monday', $d…
990 …$res['end'] = date('N', $dt)==7 ? date('Y-m-d', $dt) : date('Y-m-d', strtotime('next sunday', $dt)…
1011 $days = $this->getConf('weekdays');
1012 if($days < 1) $days = 1;
1013 if($days > 7) $days = 7;
1016 $dto->setISODate($year, $week);
1017 $ret['start'] = $dto->format('Y-m-d');
1018 $dto->modify("+$days days");
1019 $ret['end'] = $dto->format('Y-m-d');
1027 return $this->getHoursByPage($id);