+ * array( + * 'value1'=>array('disabled'=>true, 'label'=>'value 1'), + * 'value2'=>array('label'=>'value 2'), + * ); + *+ *
+ * array( + * 'value1'=>array('disabled'=>true, 'label'=>'value 1'), + * 'value2'=>array('label'=>'value 2'), + * ); + *+ *
array('post/list', 'page'=>3)
may be used to generate the URL
+ * /index.php?r=post/list&page=3
.
+ *
+ * @param mixed $url the parameter to be used to generate a valid URL
+ * @return string the normalized URL
+ */
+ public static function normalizeUrl($url)
+ {
+ if (is_array($url)) {
+ if (isset($url[0])) {
+ if (($c = Yii::app()->getController()) !== null) {
+ $url = $c->createUrl($url[0], array_splice($url, 1));
+ } else {
+ $url = Yii::app()->createUrl($url[0], array_splice($url, 1));
+ }
+ } else {
+ $url = '';
+ }
+ }
+ return $url === '' ? Yii::app()->getRequest()->getUrl() : $url;
+ }
+
+ /**
+ * Generates an input HTML tag.
+ * This method generates an input HTML tag based on the given input name and value.
+ * @param string $type the input type (e.g. 'text', 'radio')
+ * @param string $name the input name
+ * @param string $value the input value
+ * @param array $htmlOptions additional HTML attributes for the HTML tag (see {@link tag}).
+ * @return string the generated input tag
+ */
+ protected static function inputField($type, $name, $value, $htmlOptions)
+ {
+ $htmlOptions['type'] = $type;
+ $htmlOptions['value'] = $value;
+ $htmlOptions['name'] = $name;
+ if (!isset($htmlOptions['id'])) {
+ $htmlOptions['id'] = static::getIdByName($name);
+ } elseif ($htmlOptions['id'] === false) {
+ unset($htmlOptions['id']);
+ }
+ return static::tag('input', $htmlOptions);
+ }
+
+ /**
+ * Generates the list options.
+ * @param mixed $selection the selected value(s). This can be either a string for single selection or an array for multiple selections.
+ * @param array $listData the option data (see {@link listData})
+ * @param array $htmlOptions additional HTML attributes. The following two special attributes are recognized:
+ * + * array( + * 'value1'=>array('disabled'=>true, 'label'=>'value 1'), + * 'value2'=>array('label'=>'value 2'), + * ); + *+ *