本文整理汇总了PHP中Contacts::searchList方法的典型用法代码示例。如果您正苦于以下问题:PHP Contacts::searchList方法的具体用法?PHP Contacts::searchList怎么用?PHP Contacts::searchList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Contacts
的用法示例。
在下文中一共展示了Contacts::searchList方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionList
public function actionList($id = null)
{
$list = X2List::load($id);
if (!isset($list)) {
Yii::app()->user->setFlash('error', Yii::t('app', 'The requested page does not exist.'));
$this->redirect(array('lists'));
}
$model = new Contacts('search');
Yii::app()->user->setState('vcr-list', $id);
$dataProvider = $model->searchList($id);
$list->count = $dataProvider->totalItemCount;
$list->runWithoutBehavior('X2FlowTriggerBehavior', function () use($list) {
$list->save();
});
X2Flow::trigger('RecordViewTrigger', array('model' => $list));
$this->render('list', array('listModel' => $list, 'dataProvider' => $dataProvider, 'model' => $model));
}
示例2: array
//convert session var to sql
$order = preg_replace('/\\.desc$/', ' DESC', $order);
// ensure that order attribute is valid
$orderAttr = preg_replace('/ DESC$/', '', $order);
if (!is_string($orderAttr) || !Contacts::model()->hasAttribute(trim($orderAttr))) {
$order = '';
}
//look up all ids of the list we are currently viewing
//find position of model in the list
$moduleTitle = Modules::displayName();
// decide which data provider to use
if (is_numeric($listId)) {
$list = X2Model::model('X2List')->findByPk($listId);
if (isset($list)) {
$listLink = CHtml::link($list->name, array('/contacts/contacts/list', 'id' => $listId));
$vcrDataProvider = $searchModel->searchList($listId);
} else {
// default to All Contacts
$listLink = CHtml::link(Yii::t('contacts', 'All {module}', array('{module}' => $moduleTitle)), array('/contact/contacts/index'));
$vcrDataProvider = $searchModel->searchAll();
}
} elseif ($listId == 'myContacts') {
$listLink = CHtml::link(Yii::t('contacts', 'My {module}', array('{module}' => $moduleTitle)), array('/contacts/contacts/myContacts'));
$vcrDataProvider = $searchModel->searchMyContacts();
} elseif ($listId == 'newContacts') {
$listLink = CHtml::link(Yii::t('contacts', 'New {module}', array('{module}' => $moduleTitle)), array('/contacts/contacts/newContacts'));
$vcrDataProvider = $searchModel->searchNewContacts();
} elseif ($tagFlag) {
$listLink = CHtml::link(Yii::t('contacts', 'Tag Search'), array('/search/search', 'term' => $listId));
$_GET['tagField'] = $listId;
$vcrDataProvider = $searchModel->searchAll();
示例3: actionList
/**
* Gets a list of contacts.
*/
public function actionList()
{
$listId = $_POST['id'];
$list = X2List::model()->findByPk($listId);
if (isset($list)) {
//$list=X2List::load($listId);
} else {
$list = X2List::model()->findByAttributes(array('name' => $listId));
if (isset($list)) {
$listId = $list->id;
//$list=X2List::load($listId);
} else {
$this->_sendResponse(404, 'No list found with id: ' . $_POST['id']);
}
}
$model = new Contacts('search');
$dataProvider = $model->searchList($listId, 10);
$data = $dataProvider->getData();
$this->_sendResponse(200, json_encode($data), true);
}
示例4: actionList
public function actionList()
{
$id = isset($_GET['id']) ? $_GET['id'] : 'all';
if (is_numeric($id)) {
$list = CActiveRecord::model('X2List')->findByPk($id);
}
if (isset($list)) {
$model = new Contacts('searchList');
$dataProvider = $model->searchList($id);
$list->count = $dataProvider->totalItemCount;
$list->save();
$this->render('list', array('listModel' => $list, 'dataProvider' => $dataProvider, 'model' => $model));
} else {
if ($id == 'my') {
$this->redirect(array('/contacts/myContacts'));
} elseif ($id == 'new') {
$this->redirect(array('/contacts/newContacts'));
} else {
$this->redirect(array('/contacts/allContacts'));
}
}
}