common = $common; include($this->common->skinPath . "/buttons.php"); include($this->common->skinPath . "/views.php"); $this->buttons = $buttons; $this->views = $views; $this->ajtodo_roles = new AJTODO_Role($this->common); $this->ajtodo_roles->setRoles(); $this->ajtodo_alert = new AJTODO_Alert($this->common); } } public function getAllProjects($onlyactive = ""){ global $wpdb; $user = wp_get_current_user(); $sql = "SELECT * FROM ".AJTODO_DB_PROJECT." where ( authorid = $user->ID ".($onlyactive ? "and donedate is NULL" : "")." or projecttype is null ) order by updated desc"; $this->plist = $wpdb->get_results($sql); $this->plist = apply_filters('ajtodo_get_allproject', $this->plist); } public function getList($onlyactive = ""){ global $wpdb; $user = wp_get_current_user(); $sql = "SELECT * FROM ".AJTODO_DB_PROJECT." where ( authorid = $user->ID ".($onlyactive ? "and donedate is NULL" : "")." or projecttype is null ) order by updated desc"; $this->plist = $wpdb->get_results($sql); $this->plist = apply_filters('ajtodo_get_allproject', $this->plist); } public function canCreateProject(){ return current_user_can("ajtodo_project_private"); } private function getProjectListView($isteam, $isdone){ $has = false; $ret = ""; if($isteam){ if($isdone){ $ret .="
".__("완료된 팀 프로젝트","ajtodo")."
"; }else{ $ret .="
".__("진행중인 팀 프로젝트","ajtodo")."
"; } }else{ if($isdone){ $ret .="
".__("완료된 개인 프로젝트","ajtodo")."
"; }else{ $ret .="
".__("진행중인 개인 프로젝트","ajtodo")."
"; } } $ret .= "
"; foreach($this->plist as $p){ if((!$isteam && $p->projecttype == "team") || ($isteam && $p->projecttype == "private")) { continue; } if((!$isdone && $p->donedate) || ($isdone && !$p->donedate)) { continue; } $has = true; $prj = new AJTODO_Project($p); $prj->init($this->common); $ret .= $prj->getView(); } $ret .= "
".__("프로젝트 키","ajtodo")." ".__("프로젝트 이름","ajtodo")." ".__("진행상황","ajtodo")." ".__("완료","ajtodo")."/".__("전체","ajtodo")." ".($isteam ? __("멤버","ajtodo") : "")."
"; return $has ? $ret : ""; } public function getView(){ $hasDoneProject = false; $ret = ""; if(current_user_can("ajtodo_project_team_viewlist")){ $ret .= $this->getProjectListView(true, false); $ret .= $this->getProjectListView(true, true); } $ret .= $this->getProjectListView(false, false); $ret .= $this->getProjectListView(false, true); return $ret; } public function getButton($rolename){ if($this->ajtodo_roles->roles[$rolename]){ return $this->buttons[$rolename]; }else{ return ""; } } }