phpMv  -UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
HtmlRating.php
Go to the documentation of this file.
1 <?php
2 
4 
6 use Ajax\JsUtils;
7 
9  protected $_params=array();
16  public function __construct($identifier, $value,$max=5,$icon="") {
17  parent::__construct($identifier, "div", "ui {$icon} rating");
18  $this->setValue($value);
19  $this->setMax($max);
20  }
21 
26  public function setValue($value){
27  $this->setProperty("data-rating", $value);
28  }
29 
30  public function setMax($max){
31  $this->setProperty("data-max-rating", $max);
32  }
33 
38  public function run(JsUtils $js){
39  parent::run($js);
40  return $js->semantic()->rating("#".$this->identifier,$this->_params);
41  }
42 
43  public function asStar(){
44  return $this->setIcon();
45  }
46 
47  public function asHeart(){
48  return $this->setIcon("heart");
49  }
50 
51  public function setIcon($icon="star"){
52  return $this->addToPropertyCtrl("class", $icon, ["star","heart",""]);
53  }
54 
55 }
__construct($identifier, $value, $max=5, $icon="")
Definition: HtmlRating.php:16
semantic(Semantic $semantic=NULL)
getter or setter of the Semantic-UI variable
Definition: JsUtils.php:159
Base class for Semantic double elements.
JQuery PHP library.
Definition: JsUtils.php:23
addToPropertyCtrl($name, $value, $typeCtrl)