public function save($post_id, $post) { if (isset($_POST[self::FIELD_ASSIGNEE])) { $issue = new BuggyPress_Issue($post_id); $issue->set_assignee_id((int) $_POST[self::FIELD_ASSIGNEE]); } }
public function save($post_id, $post) { if (isset($_POST[self::FIELD_PROJECT])) { $issue = new BuggyPress_Issue($post_id); $issue->set_project_id((int) $_POST[self::FIELD_PROJECT]); } }
public function init() { $this->setLabel(__('Assigned To', 'buggypress')); $users = get_users(array('orderby' => 'display_name', 'order' => 'ASC', 'fields' => array('ID', 'display_name', 'user_login'))); $assignee = 0; if (isset($this->_issue)) { $assignee = $this->_issue->get_assignee_id(); } if ($assignee) { $assigned_user = new WP_User($assignee); if ($assigned_user->ID) { $this->addMultiOption($assigned_user->ID, $assigned_user->display_name); } } foreach ($users as $user) { if ($user->ID != $assignee) { $label = $user->display_name; if ($user->display_name != $user->user_login) { $label .= "({$user->user_login})"; } $this->addMultiOption($user->ID, $label); } } $this->addMultiOption(0, __('Unassigned', 'buggypress')); $this->setValue($assignee); }
public function init() { $this->setLabel(__('Description', 'buggypress')); $description = 0; if (isset($this->_issue)) { $description = $this->_issue->get_description(); } $this->setValue($description); }
public function init() { $this->setLabel(__('Title', 'buggypress')); $title = 0; if (isset($this->_issue)) { $title = $this->_issue->get_title(); } $this->setValue($title); $this->setRequired(TRUE); }
public function init() { $this->setLabel(__('Priority', 'buggypress')); $terms = BuggyPress_Issue::get_priorities(); foreach ($terms as $term) { $this->addMultiOption($term->term_id, $term->name); } if (isset($this->_issue)) { $this->setValue($this->_issue->get_priority()); } }
public function init() { $this->setLabel(__('Project', 'buggypress')); $this->addMultiOption('', __(' -- Select Project -- ', 'buggypress')); $projects = get_posts(array('post_type' => BuggyPress_Project::POST_TYPE, 'post_status' => 'publish', 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'suppress_filters' => FALSE)); foreach ($projects as $project) { $this->addMultiOption($project->ID, get_the_title($project)); } if (isset($this->_issue)) { $this->setValue($this->_issue->get_project_id()); } }
public function __construct($post_id) { parent::__construct($post_id); if (!$post_id) { $this->set_default_filters(); } }
private function create_issue($data, BuggyPress_Issue $issue = NULL) { if (!isset($issue)) { $issue = new BuggyPress_Issue(0); } // TODO - security $args = array('post_title' => $data[BuggyPress_Form_Element_IssueTitle::FIELD_NAME], 'post_content' => $data[BuggyPress_Form_Element_IssueDescription::FIELD_NAME], 'post_status' => 'publish'); $issue->save_post($args); $issue->set_project_id((int) $data[BuggyPress_Form_Element_IssueProject::FIELD_NAME]); $issue->set_assignee_id((int) $data[BuggyPress_Form_Element_IssueAssignee::FIELD_NAME]); $issue->set_type((int) $data[BuggyPress_Form_Element_IssueType::FIELD_NAME]); $issue->set_status((int) $data[BuggyPress_Form_Element_IssueStatus::FIELD_NAME]); $issue->set_priority((int) $data[BuggyPress_Form_Element_IssuePriority::FIELD_NAME]); $issue->set_resolution((int) $data[BuggyPress_Form_Element_IssueResolution::FIELD_NAME]); return $issue; }
public function init() { $this->setLabel(__('Type', 'buggypress')); $terms = BuggyPress_Issue::get_types(); foreach ($terms as $term) { $this->addMultiOption($term->term_id, $term->name); } if (isset($this->_filter)) { $this->setValue($this->_filter->get_type()); } }
/** * @param string $field * @return mixed */ private function get_old_value($field) { switch ($field) { case 'title': return $this->issue->get_title(); case 'description': return $this->issue->get_description(); case 'project': return $this->issue->get_project_id(); case 'assignee': return $this->issue->get_assignee_id(); case 'type': return $this->issue->get_type(); case 'status': return $this->issue->get_status(); case 'resolution': return $this->issue->get_resolution(); case 'priority': return $this->issue->get_priority(); default: return apply_filters('buggypress_issue_old_value', '', $field); } }
private static function register_meta_boxes() { self::$mb_assignee = add_flightless_meta_box(self::POST_TYPE, 'BuggyPress_MB_Assignee'); self::$mb_project = add_flightless_meta_box(self::POST_TYPE, 'BuggyPress_MB_IssueProject'); }
/** * Get the URL for a dynamic menu item * * @param string $item_slug * @return string */ private function get_menu_item_url($item_slug) { switch ($item_slug) { case 'project': return get_post_type_archive_link('project'); case 'newissue': $project = ''; if (!is_admin()) { global $wp_query; if (is_singular('issue')) { $issue = new BuggyPress_Issue(get_queried_object_id()); $project_id = $issue->get_project_id(); $project_post = get_post($project_id); $project = $project_post->post_name; } elseif ($project_query_var = get_query_var('project')) { $project = $project_query_var; } } return home_url(BuggyPress_NewIssuePage::get_path($project)); } return ''; }