$sql = "SELECT DISTINCT(`recipient_username`) FROM `messages` WHERE sender_username = ".$_COOKIE['username'];
if ($model->profile) {
echo DetailView::widget([
'model' => $model->profile,
......
}
public function actionUpdate($id)
{
$model = $this->findModel($id);
$sectionsList = EstimateSection::listOfSection($model->id);
foreach ($sectionsList as $section) {
$resources = new ActiveDataProvider([
'query' => EstimateResource::find()->where(['estimate_section_id' => $section->id])
]);
$sections[] = [
'section' => $section,
'resources' => $resources,
];
}
if ($this->request->isPost && $model->load($this->request->post()) && $model->save()) {
return $this->render('update', [
'model' => $model,
'sections' => $sections
]);
}
return $this->render('update', [
'model' => $model,
'sections' => $sections
]);
}
public function actionAjaxCreateSection($estimate_id) {
$section = new EstimateSection();
$section->estimate_id = $estimate_id;
$section->save();
$resources = new ActiveDataProvider([
'query' => EstimateResource::find()->where(['estimate_section_id' => $section->id])
]);
return $this->renderAjax('_new_section', [
'resources' => $resources,
'section_id' => $section->id,
]);
}
private function timeToSecond($time)
{
$part = explode(':', $time);
$second = $part[0]*3600 + $part[1]*60 + $part[2];
return $second;
}
private function secondToTime($second)
{
$hours = intdiv($second, 3600);
$minutes = intdiv(($second - $hours*3600), 60);
$seconds = $second - $hours*3600 - $minutes*60;
return date('H:i:s', mktime($hours,$minutes,$seconds));
}
tTime = self::secondToTime(self::timeToSecond($dTime) * 5)
public function search($params)
{
$query = In::find()
->joinWith(['couple', 'tur'])
->joinWith(['couple.dancerId1'=> function($q){
$q->from('dancer c1');
}])
->joinWith(['couple.dancerId2'=> function($q){
$q->from('dancer c2');
}]);
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
$this->load($params);
if (!$this->validate()) {
return $dataProvider;
}
$query
->andFilterWhere(['like', 'couple.nomer', $this->couple_nomer])
->andFilterWhere(['like', 'c1.sname', $this->dancerId1])
->andFilterWhere(['like', 'c2.sname', $this->dancerId2]);
return $dataProvider;
}