public function actionDelete($id, $confirm = 0)
 {
     $model = CallListsElements::model()->findByPk($id);
     if (!$model) {
         throw new CHttpException(404, 'Элемент списока звонков не найден');
     }
     if ($confirm) {
         $call_list_id = $model->call_list_id;
         if ($model->delete()) {
             $this->redirect(['index', 'list_id' => $call_list_id]);
         } else {
             Yii::app()->user->setFlash('error', 'Элемент списка звонков не удален');
         }
     } else {
         $this->render('delete', ['model' => $model]);
     }
 }
 public function timeCheck($attribute)
 {
     if (($model = CallListsElements::model()->find('start_time <= :time AND end_time >= :time AND call_list_id = :call_list_id', [':time' => $this->{$attribute}, ':call_list_id' => $this->call_list_id])) && $model->id !== $this->id) {
         $this->addError($attribute, 'Время пары не может пересекаться с другой');
     }
 }