public function search()
{
$criteria = new CDbCriteria;
$criteria->compare('id' ,$this->id);
$criteria->compare('name' ,$this->name,true);
$criteria->compare('role_id' ,$this->role_id);
$criteria->compare('email' ,$this->email,true);
$criteria->compare('password' ,$this->password,true);
$criteria->compare('telephone' ,$this->telephone,true);
$criteria->compare('sys_date' ,$this->sys_date);
$criteria->compare('sys_date_update' ,$this->sys_date_update);
$criteria->compare('sys_user' ,$this->sys_user);
$criteria->compare('exist', '<>' . 2);
return new CActiveDataProvider($this,
[
'criteria' => $criteria,
'pagination'=>
[
'pageSize'=>100
],
]);
}
$rooms=Room::model()->with('tarif')->findAll(array(
'order'=>'tarif.price_small'
));
SELECT
CASE
WHEN percent IS NOT NULL THEN price * percent / 100
ELSE price
END as price
FROM tarifs
function formatStringToDate(dateString) {
var regex = /(\d{2}).(\d{2}).(\d{4}) (\d{2}):(\d{2})/;
var dateArray = regex.exec(dateString);
var dateObject = new Date(
(+dateArray[3]),
(+dateArray[2])-1,
(+dateArray[1]),
(+dateArray[4]),
(+dateArray[5])
);
return dateObject;
}
var str1 = '30.10.2015 19:53';
var str2 = '26.04.2016 16:23';
var date1 = formatStringToDate(str1);
var date2 = formatStringToDate(str2);
if (date1 > date2) {
alert('date1>date2');
} else if (date2 > date1) {
alert('date1<date2');
} else {
alert('date1=date2');
}
var date1 = new Date();
var date2 = new Date('30.10.2015 19:53');
$model = Hotels::model()->fndByPk(1);
$rooms_model= new Rooms('search');
$rooms_model->hotel_id=$model->id;
$rooms_model->firm_id=Firms::FIRM_ID;
$rooms=$rooms_model->search();
$('.link').click(function(e) {
e.preventDefault;
var bool,
call;
call = $.ajax({
success : function(data) {
if(data == 'true') {
bool = true;
} else {
bool = false;
return false;
}
}
})
$.when( call ).then(function( data, textStatus, jqXHR ) {
alert(bool);
});
});
$('.link').click(function(e) {
e.preventDefault;
var bool;
$.ajax({
.done(function(data) {
if(data == 'true') {
bool = true;
} else {
bool = false;
return false;
}
alert(bool);
})
})
});