Please somebody help me… i just make private message from this extension http://www.yiiframework.com/extension/private-messaging/… i just completely finish create the extension…when i want to compose the message… field auto search for username just not working…please help me to solve this!!!
This is SuggestController
<?php
class SuggestController extends Controller {
public function actionUser() {
$q = Yii::app()->request->getParam('name_startsWith');
$userModels = (array) call_user_func(array(
CActiveRecord::model(Yii::app()->getModule('message')->userModel),
Yii::app()->getModule('message')->getSuggestMethod
), $q);
$users = array();
if ($userModels) {
foreach ($userModels as $userModel) {
$users[] = array(
'id' => $userModel->getPrimaryKey(),
'name' => call_user_func(array(
$userModel, $this->getModule()->getNameMethod
))
);
}
}
$json = CJSON::encode(array('users' => $users));
if (Yii::app()->request->getParam('callback')) {
$callback = Yii::app()->request->getParam('callback');
$json = $callback . '('. $json . ')';
}
header('Cache-Control: no-store');
header('Pragma: no-store');
header("Content-type: application/json");
echo $json;
Yii::app()->end();
}
}