public function actionSave()
 {
     $user = Yii::app()->user->getProfile();
     $quoteText = Yii::app()->getRequest()->getParam('text', null);
     if (!$quoteText === null) {
         return false;
     }
     $blockId = Yii::app()->getRequest()->getParam('blockId', null);
     if ($blockId !== null) {
         $arr = explode('-', $blockId);
         $blockId = key_exists(0, $arr) ? (int) $arr[0] : 0;
         $block = Block::model()->published()->findByPK($blockId);
         if ($block === false) {
             return false;
         }
     } else {
         return false;
     }
     // Создаем и сохраняем цитату
     $quote = new Quote();
     $quote->user_id = $user->id;
     $quote->block_id = $block->id;
     $quote->content = $quoteText;
     if ($quote->save()) {
         // Общее кол-во цитат
         $totalCount = Quote::model()->user($user->id)->program($quote->course_type_id)->count();
         // Возвращаем ответ
         $resp = array('status' => 1, 'data' => array('id' => $quote->id, 'text' => $quote->getContent(), 'url' => $quote->getUrl(), 'totalCount' => $totalCount));
         Yii::app()->ajax->raw($resp);
     } else {
         $resp = array('status' => 0, 'error' => 'Ошибка сохранения.');
         Yii::app()->ajax->raw($resp);
     }
 }