/** * Sets selected options of this custom field. * * @param kyCustomFieldOption[] $options List of options. * @return kyCustomFieldMultiSelect */ public function setSelectedOptions($options) { //make sure it's array if (!is_array($options)) { if ($options === null) { $options = array(); } else { $options = array($options); } } //check for proper class and eliminate duplicates $options_ids = array(); $this->options = array(); foreach ($options as $option) { $option = ky_assure_object($option, 'kyCustomFieldOption'); if ($option !== null && !in_array($option->getId(), $options_ids)) { $this->options[] = $option; $options_ids[] = $option->getId(); } } //update raw value $option_values = array(); foreach ($this->options as $field_option) { $option_values[] = $field_option->getValue(); } $this->raw_value = implode(self::VALUES_SEPARATOR, $option_values); }
/** * Sets the field selected option. * * @param kyCustomFieldOption $option Child (linked) field option. * @return kyCustomFieldLinkedSelect */ public function setSelectedOption($option) { $this->option = ky_assure_object($option, 'kyCustomFieldOption'); if ($this->option !== null) { $parent_option = $this->getOption($this->option->getParentOptionId()); $this->raw_value = implode(self::PARENT_CHILD_SEPARATOR, array($parent_option->getValue(), $this->option->getValue())); } else { $this->raw_value = null; } return $this; }
/** * Sets the field selected option. * * @param kyCustomFieldOption $option Field option. * @return kyCustomFieldWithOptions */ public function setSelectedOption($option) { $this->option = ky_assure_object($option, 'kyCustomFieldOption'); $this->raw_value = $this->option !== null ? $this->option->getValue() : null; return $this; }
/** * Sets staff user, owner of this ticket. * * @param kyStaff $owner_staff Staff user. * @return kyTicket */ public function setOwnerStaff($owner_staff) { $this->owner_staff = ky_assure_object($owner_staff, 'kyStaff'); $this->owner_staff_id = $this->owner_staff !== null ? $this->owner_staff->getId() : null; return $this; }
/** * Sets staff group for the staff user. * * @param kyStaffGroup $staff_group Staff group object. * @return kyStaff */ public function setStaffGroup($staff_group) { $this->staff_group = ky_assure_object($staff_group, 'kyStaffGroup'); $this->staff_group_id = $this->staff_group !== null ? $staff_group->getId() : null; return $this; }
/** * Sets user organization assigned to the user. * * @param kyUserOrganization $user_organization User organization. * @return kyUser */ public function setUserOrganization(kyUserOrganization $user_organization) { $this->user_organization = ky_assure_object($user_organization, 'kyUserOrganization'); $this->user_organization_id = $this->user_organization !== null ? $this->user_organization->getId() : null; return $this; }
/** * Sets staff user, the editor of this news item update. * * @param kyStaff $staff Staff user. * @return kyNewsItem */ public function setEditedStaff($staff) { $this->edited_staff = ky_assure_object($staff, 'kyStaff'); $this->edited_staff_id = $this->edited_staff !== null ? $this->edited_staff->getId() : null; return $this; }
/** * Sets parent department for this department. * * @param kyDepartment $parent_department Department object that will be the parent for this department. * @return kyDepartment */ public function setParentDepartment($parent_department) { $this->parent_department = ky_assure_object($parent_department, 'kyDepartment'); $this->parent_department_id = $this->parent_department !== null ? $this->parent_department->getId() : null; return $this; }
/** * Sets the parent comment (comment that this comment is a reply to). * * @param kyCommentBase $parent_comment Parent comment (comment that this comment is a reply to). * @return $this */ public function setParentComment($parent_comment) { $this->parent_comment = ky_assure_object($parent_comment, get_class($this)); $this->parent_comment_id = $this->parent_comment !== null ? $this->parent_comment->getId() : null; return $this; }
/** * Sets staff user, the creator of this knowledgebase article. * * @param kyStaff $staff Staff user. * @return kyKnowledgebaseArticle */ public function setStaff($creator) { $this->creator = ky_assure_object($creator, 'kyStaff'); $this->creator_id = $this->creator !== null ? $this->creator->getId() : null; return $this; }
/** * Sets staff user, the creator of this post. * * @param kyStaff $staff Staff user. * @return kyTicketPost */ public function setStaff($staff) { $this->staff = ky_assure_object($staff, 'kyStaff'); $this->staff_id = $this->staff !== null ? $this->staff->getId() : null; $this->creator = $this->staff !== null ? self::CREATOR_STAFF : null; $this->user_id = null; $this->user = null; return $this; }
/** * Sets staff user that creates the time track. * * @param kyStaff $creator_staff Staff user that creates the time track. * @return kyTicketTimeTrack */ public function setCreatorStaff($creator_staff) { $this->creator_staff = ky_assure_object($creator_staff, 'kyStaff'); $this->creator_staff_id = $this->creator_staff !== null ? $this->creator_staff->getId() : null; $this->creator_staff_name = $this->creator_staff !== null ? $this->creator_staff->getFullName() : null; return $this; }
/** * Sets the ticket post this attachment will be attached to. * * Automatically sets the ticket. * * @param kyTicketPost $ticket_post Ticket post. */ public function setTicketPost($ticket_post) { $this->ticket_post = ky_assure_object($ticket_post, 'kyTicketPost'); $this->ticket_post_id = $this->ticket_post !== null ? $this->ticket_post->getId() : null; $this->ticket = $this->ticket_post !== null ? $this->ticket_post->getTicket() : null; $this->ticket_id = $this->ticket !== null ? $this->ticket->getId() : null; }
/** * Sets news item. * * @param kyNewsItem $news_item News item. * @return kyNewsComment */ public function setNewsItem($news_item) { $this->news_item = ky_assure_object($news_item, 'kyNewsItem'); $this->news_item_id = $this->news_item !== null ? $this->news_item->getId() : null; return $this; }
/** * Sets KnowledgebaseArticle. * * @param kyKnowledgebaseArticle $kbarticle kbarticle item. * @return kyKnowledgebaseComment */ public function setKbarticle($kbarticle) { $this->kbarticle = ky_assure_object($kbarticle, 'kyKnowledgebaseArticle'); $this->kbarticle_id = $this->kbarticle !== null ? $this->kbarticle->getId() : null; return $this; }
/** * Sets the troubleshooterstep item * * @param int $troubleshooterstep_item * * @return $this */ public function setTroubleshooterStep($troubleshooterstep_item) { $this->troubleshooterstep_item = ky_assure_object($troubleshooterstep_item, 'kyTroubleshooterStep'); $this->troubleshooterstep_item_id = $this->troubleshooterstep_item !== null ? $this->troubleshooterstep_item->getId() : null; return $this; }