public function __construct($label, $name, $value, $with_none = false, $onchange = "", $desc = "") { parent::__construct($label, $name, $value, $with_none, $onchange, $desc); foreach (array('day', 'week', 'month', 'year') as $scale) { $selected = $this->value == $scale; $this->addOption(new HTML_Element_Option($GLOBALS['Language']->getText('plugin_graphontrackers_date_scale', $scale), $scale, $selected)); } }
public function __construct($tracker, $label, $name, $value, $with_none = false, $onchange = "", $desc = "") { parent::__construct($label, $name, $value, $with_none, $onchange, $desc); require_once TRACKER_BASE_DIR . '/Tracker/FormElement/Tracker_FormElementFactory.class.php'; $aff = Tracker_FormElementFactory::instance(); foreach ($aff->getUsedDateFields($tracker) as $field) { if ($field->userCanRead()) { $selected = $this->value == $field->id; $this->addOption(new HTML_Element_Option($field->getLabel(), $field->id, $selected)); } } }
/** * @param $label String the label of the field * @param $name String the name of the input * @param $value mixed the current value of the field * @param $id int The item id * @param $siblings array the sibling of the item array('id' => 123, 'name' => 'Item display name', 'rank' => 4) */ public function __construct($label, $name, $value, $id, $siblings) { parent::__construct($label, $name, $value); $this->addOption(new HTML_Element_Option($GLOBALS['Language']->getText('global', 'at_the_beginning'), 'beginning', false)); $this->addOption(new HTML_Element_Option($GLOBALS['Language']->getText('global', 'at_the_end'), 'end', false)); $this->addOption(new HTML_Element_Option('--', '--', false)); foreach ($siblings as $i => $item) { if ($item['id'] != $id) { $this->addOption(new HTML_Element_Option($GLOBALS['Language']->getText('global', 'after', $item['name']), $item['rank'] + 1, isset($siblings[$i + 1]) && $siblings[$i + 1]['id'] == $id)); } } }
public function __construct($label, $name, $value, $with_none = false, $onchange = "", $desc = "") { parent::__construct($label, $name, $value, $with_none, $onchange, $desc); require_once 'common/tracker/ArtifactFieldFactory.class.php'; require_once 'common/tracker/ArtifactType.class.php'; $at = new ArtifactType($GLOBALS['ath']->Group, $GLOBALS['ath']->getID(), false); $aff = new ArtifactFieldFactory($at); foreach ($aff->getAllUsedFields() as $field) { if ($field->userCanRead($GLOBALS['group_id'], $GLOBALS['ath']->getID(), user_getid())) { if ($field->isdateField()) { $selected = $this->value == $field->getName(); $this->addOption(new HTML_Element_Option($field->getLabel(), $field->getName(), $selected)); } } } }