public function getFullRESTValue(Tracker_FormElement_Field_List_Value $value)
 {
     $class_user_representation = '\\Tuleap\\Project\\REST\\UserGroupRepresentation';
     $ugroup_representation = new $class_user_representation();
     $ugroup_manager = new UGroupManager();
     $project = $this->getField()->getTracker()->getProject();
     $user_group = $ugroup_manager->getUGroupByName($project, $value->getLabel());
     $ugroup_representation->build($project->getID(), $user_group);
     return $ugroup_representation;
 }
 private function fetchAdminEditRowModifiable(Tracker_FormElement_Field_List_Value $v)
 {
     $html = '';
     $hp = Codendi_HTMLPurifier::instance();
     $is_hidden = $v->isHidden();
     $html .= '<tr valign="top" class="' . ($is_hidden ? 'tracker_admin_static_value_hidden' : '') . '">';
     $html .= '<td>';
     if (isset($this->decorators[$v->getId()])) {
         $html .= $this->decorators[$v->getId()]->decorateEdit();
     } else {
         $html .= Tracker_FormElement_Field_List_BindDecorator::noDecoratorEdit($this->field->id, $v->getId());
     }
     $html .= '</td>';
     $html .= '<td>';
     $html .= '<input type="text" name="bind[edit][' . $v->getId() . '][label]" value="' . $hp->purify($v->getLabel(), CODENDI_PURIFIER_CONVERT_HTML) . '" />';
     $html .= '<textarea name="bind[edit][' . $v->getId() . '][description]" style="vertical-align:top;" cols="50" rows="3">' . $hp->purify($v->getDescription(), CODENDI_PURIFIER_CONVERT_HTML) . '</textarea>';
     $html .= '</td>';
     //{{{ Actions
     $html .= '<td style="white-space:nowrap;">';
     $img_params = array();
     $icon_suffix = '';
     if ($this->canValueBeHidden($v)) {
         $checked = '';
         if ($is_hidden) {
             $icon_suffix = '-half';
         } else {
             $checked = 'checked="checked"';
         }
         $html .= '<input type="hidden" name="bind[edit][' . $v->getId() . '][is_hidden]" value="1" />';
         $html .= '<input type="checkbox" name="bind[edit][' . $v->getId() . '][is_hidden]" value="0" ' . $checked . ' class="tracker_admin_static_value_hidden_chk" />';
         $img_params['alt'] = 'show/hide value';
         $img_params['title'] = $GLOBALS['Language']->getText('plugin_tracker_formelement_admin', 'hide_value');
     } else {
         $icon_suffix = '--exclamation-hidden';
         $img_params['alt'] = 'cannot hide';
         $img_params['title'] = $GLOBALS['Language']->getText('plugin_tracker_formelement_admin', 'hide_value_impossible');
     }
     $html .= $GLOBALS['HTML']->getImage('ic/eye' . $icon_suffix . '.png', $img_params);
     $html .= ' ';
     if ($this->canValueBeDeleted($v)) {
         $html .= '<a title="Delete the value"
             href="' . TRACKER_BASE_URL . '/?' . http_build_query(array('tracker' => $this->field->getTracker()->id, 'func' => 'admin-formElement-update', 'formElement' => $this->field->getId(), 'bind-update' => 1, 'bind[delete]' => $v->getId())) . '">' . $GLOBALS['HTML']->getImage('ic/cross.png') . '</a>';
     } else {
         $html .= $GLOBALS['HTML']->getImage('ic/cross-disabled.png', array('title' => "You can't delete"));
     }
     $html .= '</td>';
     //}}}
     $html .= '</tr>';
     return $html;
 }
 protected function fetchFieldValue(Tracker_FormElement_Field_List_Value $value, $name, $is_selected)
 {
     $id = $value->getId();
     if ($id == Tracker_FormElement_Field_List_Bind_StaticValue_None::VALUE_ID) {
         $label = $value->getLabel();
     } else {
         $label = $this->getBind()->formatArtifactValue($id);
     }
     $style = $this->getBind()->getSelectOptionInlineStyle($id);
     $selected = $is_selected ? 'selected="selected"' : '';
     return '<option value="' . $id . '" ' . $selected . ' title="' . $label . '" style="' . $style . '">' . $label . '</option>';
 }
 public function getFullRESTValue(Tracker_FormElement_Field_List_Value $value)
 {
     return array('label' => $value->getLabel(), 'id' => $value->getId());
 }
 public function getFullRESTValue(Tracker_FormElement_Field_List_Value $value)
 {
     $user_manager = UserManager::instance();
     $class_user_representation = '\\Tuleap\\User\\REST\\UserRepresentation';
     $user_representation = new $class_user_representation();
     $user = $user_manager->getUserByUserName($value->getLabel());
     if (!$user) {
         $user = new PFUser();
         $user->setEmail($value->getLabel());
     }
     $user_representation->build($user);
     return $user_representation;
 }
示例#6
0
 public function getValueLabel()
 {
     return $this->value->getLabel();
 }