echo '<div class="column">';
echo CHtml::label($rows[$i]['name'], $rows[$i]['name']);
echo CHtml::textField("elem[$id][val][]", $val, array('id' => $rows[$i]['name']));
echo '</div>';
echo '<div class="column" style="display:none">';
echo CHtml::textField("elem[$id][type][]", $type, array('id' => $rows[$i]['name']));
echo '</div>';
<div class="column">
<label for="Вагонов">Вагонов</label>
<input id="Вагонов" type="text" name="elem[5][val][]" value="">
</div>
<div class="column" style="display:none">
<input id="Вагонов" type="text" name="elem[5][type][]" value="int">
</div>
if (isset($_POST['elem']))
{
$command = Yii::app()->db->createCommand();
$max = Yii::app()->db->createCommand()
->select('max(id) as max')
->from('a_analiz_create')
->queryScalar();
$Ids = $_POST['elem'];
$cnt = max(array_keys($Ids));
$min = min(array_keys($Ids));
for($i = $min; $i <= $cnt; $i++)
{
$type = $Ids[$i]['type'][0];
$val = $Ids[$i]['val'][0];
if ($type == 'float')
{
(real)$val = str_replace(',','.',$val);
}
else if ($type == 'int')
{
$val = (int)$val;
}
if (isset($val) && !empty($val))
$command->insert('a_analiz_data', array(
'analiz_id' => $max,
'value' => $val,
'elem_id' => $i,
'user_id' => Yii::app()->user->id,
));
}
};
select * from
crosstab('SELECT
t1.analiz_id,
t1.elem_id,
t1.value
FROM
a_analiz_data t1
WHERE
t1.analiz_id =36
', //analiz_id - общий ид,
//elem_id - имя элемента
//value - отображаемое значение
' SELECT
elem_id //elem_id - видимо нужен для связи двух таблиц
FROM
a_analiz_data t1
WHERE
t1.analiz_id = 36')
as (rowid int, att1 text, att2 text, att3 text, att4 text, att5 text, att6 text, att7 text);
SELECT
t1.value,
t1.elem_id
FROM
a_analiz_data t1
WHERE
t1.analiz_id =36
$sql = '
WITH RECURSIVE temp1 ( id,id_parent,name,PATH, LEVEL, NAME ) AS (
SELECT T1.id,T1.id_parent, T1.name, CAST (T1.id AS VARCHAR (50)) as PATH, 1 ,
CAST (T1.name AS VARCHAR (255)) as NAME
FROM vgok_site.t_department T1 WHERE T1.id_parent = 0
union
select T2.id, T2.id_parent, T2.name, CAST ( temp1.PATH ||\'->\'|| T2.id AS VARCHAR(50)) ,LEVEL + 1 ,
CAST ((repeat(\' _ \', LEVEL+1)||T2.name) AS VARCHAR(255))
FROM vgok_site.t_department T2 INNER JOIN temp1 ON( temp1.id= T2.id_parent))
select * from temp1 ORDER BY PATH LIMIT 100
';
array(
'class' => 'bootstrap.widgets.TbButtonColumn',
'template' => '{view}',
'buttons' => array
(
'view' => array
(
//'url' => '$data->id."|".$data->parent_id',
'url' => '$data->id',
'click' => 'function(){
data=$(this).attr("href").split("|")
$("#myModalHeader").html(data[0]);
$("#myModalBody").load("' . $this->createUrl('modalView') . '/"+data[0]+"");
$("#myModal").modal();
return false;
}',
),
)
),
),
));
?>
public function actionModalView($id)
{
$this->renderPartial('view', array(
'model' => $this->loadModel($id),
));
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>test</title>
<script>
function on()
{
if (document.getElementById('res').innerHTML.length == 0) {
document.getElementById('res').innerHTML = document.getElementById('hlt').innerHTML - document.getElementById('atk').innerHTML;
} else {
if (document.getElementById('res').innerHTML <= 0)
alert("Вы проиграли");
else
document.getElementById('res').innerHTML -= document.getElementById('atk').innerHTML;
}
}
</script>
</head>
<body>
<div id = "hlt">10</div>
<div id = "atk">1</div>
<div id = "res"></div>
<button onclick="on()">ha</button>
</body>
</html>
echo CHtml::ajaxLink(
$text = 'Click me',
array('req'),
$ajaxOptions=array (
'type'=>'POST',
'update'=>'#content',
'data' => array( 'id' => '44'),
),
$htmlOptions=array (
)
);
public function actionReq() {
$content = $this->renderPartial('application.views.site.pages.frameset');
}
$page = $_POST['id'];
$page = Page::model()->findByPk($page)->link;
echo '
<iframe id="ifr" src="' . $page . '" align="center">
</iframe>';
var div = document.getElementById('yw2')
var elems = div.getElementsByTagName('*')
var div = document.getElementById('yw2')
var elems = div.getElementsByTagName('*')
var elem = [];
for(var i=0; i<elems.length; i++) {
id = elems[i].id;
if (id)
elem[id] = document.getElementById(id);
}
console.log(elem[13]);
console.log(document.getElementById('13').classList.contains('open'));
elem[13].classList.toggle('open');
console.log(document.getElementById('13').classList.contains('closed'));
<li id="13" class="closed">
false
true
public function rules()
{
return array(
// username and password are required
//array('username, password', 'required'),
array('username, password', 'safe'),
// rememberMe needs to be a boolean
array('rememberMe', 'boolean'),
// password needs to be authenticated
array('password', 'authenticate'),
);
}
if (empty($this->username)) $ldapuser = User::model()->find('LOWER(login)=?', array(strtolower(getenv("username"))));
if ($ldapuser)
{
$this->_id = $ldapuser->id;
$this->username = $ldapuser->login;
$this->errorCode = self::ERROR_NONE;
}
else if ($user === null)
$this->errorCode = self::ERROR_USERNAME_INVALID;