[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhabricatorFlagSelectControl extends AphrontFormControl { 4 5 public function getCustomControlClass() { 6 return 'phabricator-flag-select-control'; 7 } 8 9 public function renderInput() { 10 require_celerity_resource('phabricator-flag-css'); 11 12 $colors = PhabricatorFlagColor::getColorNameMap(); 13 14 $value_map = array_fuse($this->getValue()); 15 16 $file_map = array( 17 PhabricatorFlagColor::COLOR_RED => 'red', 18 PhabricatorFlagColor::COLOR_ORANGE => 'orange', 19 PhabricatorFlagColor::COLOR_YELLOW => 'yellow', 20 PhabricatorFlagColor::COLOR_GREEN => 'green', 21 PhabricatorFlagColor::COLOR_BLUE => 'blue', 22 PhabricatorFlagColor::COLOR_PINK => 'pink', 23 PhabricatorFlagColor::COLOR_PURPLE => 'purple', 24 PhabricatorFlagColor::COLOR_CHECKERED => 'finish', 25 ); 26 27 $out = array(); 28 foreach ($colors as $const => $name) { 29 // TODO: This should probably be a sprite sheet. 30 $partial = $file_map[$const]; 31 $uri = '/rsrc/image/icon/fatcow/flag_'.$partial.'.png'; 32 $uri = celerity_get_resource_uri($uri); 33 34 $icon = id(new PHUIIconView()) 35 ->setImage($uri); 36 37 $input = phutil_tag( 38 'input', 39 array( 40 'type' => 'checkbox', 41 'name' => $this->getName().'[]', 42 'value' => $const, 43 'checked' => isset($value_map[$const]) 44 ? 'checked' 45 : null, 46 'class' => 'phabricator-flag-select-checkbox', 47 )); 48 49 $label = phutil_tag( 50 'label', 51 array( 52 'class' => 'phabricator-flag-select-label', 53 ), 54 array( 55 $icon, 56 $input, 57 )); 58 59 $out[] = $label; 60 } 61 62 return $out; 63 } 64 65 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |