本文整理匯總了PHP中Quote::getContent方法的典型用法代碼示例。如果您正苦於以下問題:PHP Quote::getContent方法的具體用法?PHP Quote::getContent怎麽用?PHP Quote::getContent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Quote
的用法示例。
在下文中一共展示了Quote::getContent方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: actionSave
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);
}
}