ajtodo_roles = new AJTODO_Role(); $this->ajtodo_roles->setRoles(); } public function init($common){ if(isset($common)){ $this->common = $common; include($this->common->skinPath . "/buttons.php"); include($this->common->skinPath . "/views.php"); include($this->common->skinPath . "/js_templates.php"); $this->js_templates = $js_templates; $this->buttons = $buttons; $this->views = $views; $this->ajtodo_alert = new AJTODO_Alert($this->common); } } public function getFilter(){ $ret = "
"; $ret .= $this->views["TodoListProjectFilter"]; $ret .= $this->views["TodoListFilter"]; $ret .= "
"; $ret .= ""; return $ret; } public function getDefaultTodoType(){ $ret = ""; foreach($this->project->todotype as $r){ if($r["default"] == "Y"){ $ret = $r; } } $ret = apply_filters('ajtodo_get_defaulttodotype', $ret, $this->project->id); return $ret; } public function getCreateTodoBox(){ $defaultType = $this->getDefaultTodoType(); $ret = "
"; return $ret; } public function getView(){ $ret = "
"; $ret .= "
"; $ret .= " "; $ret .= "

".__("완료된 일들","ajtodo")."

"; $ret .= " "; $ret .= "
"; $ret .= "
"; $ret .= "
"; $ret .= "
"; return $ret; } public function getUserProgressView(){ return $this->views["UserProgress"]; } public function getTodoTypes(){ global $wpdb; $ret = array(); $wh = ""; $sql = "SELECT todotype, count(*) as cnt FROM ".AJTODO_DB_TODO."_".$this->project->id; if($this->planid !== "") $sql .= " where planid = ".$this->planid; $sql .= " group by todotype"; $ret["todotypes"] = $wpdb->get_results($sql); return $ret; } public function getUserProgress(){ global $wpdb; $ret = array(); $wh = ""; $sql = "SELECT statuskey, count(*) as cnt FROM ".AJTODO_DB_TODO."_".$this->project->id; if($this->planid !== "") $sql .= " where planid = ".$this->planid; $sql .= " group by statuskey"; $ret["statuses"] = $wpdb->get_results($sql); return $ret; } public function getList(){ global $wpdb; $userid = $this->uid ? $this->uid : wp_get_current_user()->ID; $ret = array(); $sql = "SELECT a.*, COUNT(b.id) AS docs FROM ".AJTODO_DB_TODO."_".$this->project->id." as a "; $sql .= " left JOIN ".AJTODO_DB_LINK." as b "; $sql .= "on a.id = b.todoid and a.projectid = b.projectid where 0 = 0 "; if($this->statuskey != ""){ $sql .= " and a.statuskey = '".$this->statuskey."' "; } if($this->planid != "") $sql .= " and a.planid = ".$this->planid; if($this->authorid) $sql .= " and a.authorid = $this->authorid "; if($this->assignid) $sql .= " and a.assignid = $this->assignid "; if($this->todotype) $sql .= " and a.todotype = '".$this->todotype."' "; if($this->search) $sql .= " and a.title like '%$this->search%' "; $sql .= " group by a.tkey "; $sql .= " order by a.donedated, a.updated desc, a.regdate desc"; $this->todolist = $wpdb->get_results($sql); $this->todolist = apply_filters('ajtodo_get_todolist', $this->todolist, $this->project->id); $ret["result"] = true; $ret["todolist"] = $this->todolist; return $ret; } public function getForm($viewname){ return $this->views[$viewname]; } }