本文整理汇总了PHP中Client::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::model方法的具体用法?PHP Client::model怎么用?PHP Client::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Client
的用法示例。
在下文中一共展示了Client::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionView
/**
* @param $id
* @throws CHttpException
*/
public function actionView($id)
{
$model = Client::model()->findByPk($id);
if (null === $model) {
throw new CHttpException(404);
}
$this->render('view', ['model' => $model, 'order' => new Order(), 'orders' => $model->getOrders()]);
}
示例2: loadModel
/**
* Returns the data model based on the primary key given in the GET variable.
* If the data model is not found, an HTTP exception will be raised.
* @param integer the ID of the model to be loaded
*/
public function loadModel($id)
{
$model = Client::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, 'Запрашиваемая страница не существует.');
}
return $model;
}
示例3: clientNum
protected function clientNum($oid)
{
$num = Client::model()->count(array('condition'=>"oid=$oid"));
if($num){
return $num;
}else{
return 0;
}
}
示例4: parseBouncedEvent
private static function parseBouncedEvent($value)
{
if ($model = MandrillEmail::model()->findByPk($value['msg']['_id'])) {
$model->status = MandrillEmail::STATUS_BOUNCED;
$model->save();
if ($value['msg']['email']) {
Client::model()->updateAll(['invalidEmail' => Client::INVALID_EMAIL], 'cli_email = :email', ['email' => $value['msg']['email']]);
}
}
}
示例5: actionDisplaySave
public function actionDisplaySave($id = 0, $instructionId = 0)
{
$this->layout = '//layouts/new/popup';
$cliId = isset($_GET['cliId']) ? $_GET['cliId'] : 0;
$model = new Offer();
if ($id) {
$model = Offer::model()->findByPk($id);
$instructionId = empty($instructionId) ? $model->off_deal : $instructionId;
if (!$cliId) {
$this->actionSaveClientToOffer($cliId, $id);
}
}
if (isset($_POST['delete']) && $_POST['delete'] || isset($_POST['restore']) && $_POST['restore']) {
$model->off_status = isset($_POST['delete']) ? Offer::STATUS_DELETED : Offer::STATUS_SUBMITTED;
if ($model->save()) {
if (isset($_POST['delete'])) {
Yii::app()->user->setFlash('offer-deleted', 'Offer is deleted!');
} else {
Yii::app()->user->setFlash('offer-restored', 'Offer is restored!');
}
Yii::app()->user->setFlash('offer-callback', isset($_GET['callback']) ? $_GET['callback'] : "");
$this->redirect(array('displaySave', 'id' => $id, 'instructionId' => $instructionId, 'callback' => isset($_GET['callback']) ? $_GET['callback'] : "", 'close' => isset($_POST['close'])));
}
} else {
if (isset($_POST['Offer']) && $_POST['Offer']) {
$model->attributes = $_POST['Offer'];
if ($model->save()) {
if (isset($_POST['Offer']['clientId']) && $_POST['Offer']['clientId']) {
$this->actionSaveClientToOffer($_POST['Offer']['clientId'], $model->off_id);
}
if (isset($_POST['Offer']['clientStatus']) && $_POST['Offer']['clientStatus']) {
$clientStatus = $_POST['Offer']['clientStatus'];
$clientStatusType = Deal::model()->findByPk($instructionId)->dea_type == Deal::TYPE_SALES ? 'cli_salestatus' : 'cli_letstatus';
foreach ($clientStatus as $clientId => $clientStatusId) {
Client::model()->updateByPk($clientId, [$clientStatusType => $clientStatusId]);
}
}
Yii::app()->user->setFlash('offer-updated', 'Saved!');
Yii::app()->user->setFlash('offer-callback', isset($_GET['callback']) ? $_GET['callback'] : "");
$this->redirect(array('displaySave', 'id' => $model->off_id, 'instructionId' => $instructionId, 'callback' => isset($_GET['callback']) ? $_GET['callback'] : "", 'close' => isset($_POST['close']) ? true : false));
}
}
}
if (Yii::app()->user->hasFlash('offer-callback')) {
$callback = Yii::app()->user->getFlash('offer-callback');
$callbackObj = new PopupCallback($callback);
if ($callback == 'showInstructionOffers') {
$callbackObj->run(array($instructionId), isset($_GET['close']) && $_GET['close']);
} else {
$callbackObj->run(array($model->off_id), isset($_GET['close']) && $_GET['close']);
}
}
$this->render('edit', ['model' => $model, 'instructionId' => $instructionId, 'clientId' => $cliId]);
}
示例6: actionSelectProperty
/**
* Step 2
*
* @throws CHttpException
* @return void
* @internal param $clientId
*/
public function actionSelectProperty()
{
$clientId = AppointmentBuilder::getCurrent()->getClientId();
/**
* @var $client Client
*/
$client = Client::model()->findByPk($clientId);
if (!$client) {
throw new CHttpException('404', 'Client [id: ' . $clientId . '] is not found');
}
$this->render('selectProperty', ['model' => $client]);
}
示例7: getDataBySearch
private function getDataBySearch($search)
{
$data = [];
$clients = Client::model()->quickSearch($search);
foreach ($clients as $key => $client) {
$data[] = ['label' => $client->getFullName(), 'value' => $client->getFullName(), 'url' => $this->createUrl('client/update', ['id' => $client->cli_id])];
}
$instructions = Deal::model()->quickSearch($search);
foreach ($instructions as $key => $instr) {
$title = $instr->address->line1 . ' ' . $instr->title;
$data[] = ['label' => $title, 'value' => $title, 'url' => $this->createUrl('instruction/summary', ['id' => $instr->dea_id])];
}
return $data;
}
示例8: actionReplyMessage
public function actionReplyMessage()
{
if (isset(Yii::app()->params['twilio']['replyMessage']) && Yii::app()->params['twilio']['replyMessage']) {
file_put_contents(Yii::app()->params['logDirPath'] . '/twilio_request.log', print_r($_REQUEST, true) . "\n\n", FILE_APPEND);
$phone = str_replace('+44', '', $_REQUEST['From']);
$client = Client::model()->findByPhone($phone);
$sms = new Sms();
$sms->clientId = $client ? $client->cli_id : 0;
$sms->receive($_REQUEST);
if ($client) {
$latestText = Sms::model()->latestTextToClient($client);
}
header('content-type: text/xml');
echo '<Response><Sms><![CDATA[' . Yii::app()->params['twilio']['replyMessage'] . ']]></Sms></Response>';
}
}
示例9: actionOpen
public function actionOpen($client, $mail)
{
$hit = new MandrillMailshotHit();
$mailshot = MandrillMailshot::model()->findByPk($mail);
$client = Client::model()->findByPk($client);
if (!$mailshot) {
throw new CHttpException('mailshot [id : ' . $mail . '] was not found');
}
if (!$client) {
throw new CHttpException('client [id : ' . $client . '] was not found');
}
$hit->clientId = $client->cli_id;
$hit->mailshotId = $mailshot->id;
$hit->userAgent = Yii::app()->request->getUserAgent();
$hit->ip = Yii::app()->request->getUserHostAddress();
$hit->save();
$this->redirect(['property/view', 'id' => $mailshot->instructionId]);
}
示例10: validateClientEmail
public function validateClientEmail($email, $params)
{
if ($this->{$email}) {
/** @var $client Client */
$criteria = new CDbCriteria();
$criteria->compare('cli_email', $this->{$email});
$criteria->with = ['telephones'];
/** @var $client Client */
$clients = Client::model()->findAll($criteria);
if ($client = $clients[0]) {
$this->name = $client->cli_fname;
$this->surname = $client->cli_sname;
$this->telephone = $client->telephones[0]->tel_number;
$this->addError('registeredInfo', 'You are already registered.');
return false;
}
}
}
示例11: edit
/**
* if $_GET['owner'] is passed that means that proeprty will have an owner before it is created.
* it is used in situation when wi select a client and want to create a property for him (valuation for example) then it is obvious that client is an owner
*
* @param Property $model property to edit
*/
public function edit(Property $model)
{
/**
* @var $address Address
*/
if (isset($_POST['Property']) && $_POST['Property']) {
$model->attributes = $_POST['Property'];
$model->setClients(isset($_POST['owner']) && $_POST['owner'] ? $_POST['owner'] : [], Property::CLIENT_TYPE_OWNER);
$model->setClients(isset($_POST['tenant']) && $_POST['tenant'] ? $_POST['tenant'] : [], Property::CLIENT_TYPE_TENANT);
if (isset($_POST['propertyAddress']['id']) && $_POST['propertyAddress']['id']) {
$address = Address::model()->findByPk($_POST['propertyAddress']['id']);
if ($address) {
$model->setAddress($address);
}
}
if ($model->save()) {
Yii::app()->user->setFlash('property-update-success', 'Property updated.');
$url = array('update', 'id' => $model->pro_id);
if (isset($_GET['nextStep']) && $_GET['nextStep']) {
if (isset($_POST['proceed'])) {
if ($_GET['nextStep'] == 'AppointmentBuilder_propertySelected') {
}
$url = $this->createUrl('AppointmentBuilder/propertySelected', ['propertyId' => $model->pro_id]);
} else {
$url['nextStep'] = $_GET['nextStep'];
}
}
$this->redirect($url);
}
}
$suggesstedOwner = null;
if (Yii::app()->user->hasFlash('suggest-new-owner')) {
$suggesstedOwner = Client::model()->findByPk(Yii::app()->user->getFlash('suggest-new-owner', null, false));
}
$this->render('edit', ['model' => $model, 'suggestedOwner' => $suggesstedOwner]);
}
示例12: loadModel
/**
* Returns the data model based on the primary key given in the GET variable.
* If the data model is not found, an HTTP exception will be raised.
* @param integer the ID of the model to be loaded
*/
public function loadModel($id)
{
$model = Client::model()->findByPk((int) $id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}
示例13: ob_start
<?php
/**
* @var $offerClientList Deal Owners OR deal tenants
* @ var $clientStatusType
* @ var $instructionType
*/
ob_start();
$data = '';
if ($offerClientList) {
$data = $data . '<table cellpadding="2 5 2 5">';
foreach ($offerClientList as $offerClient) {
$data = $data . '<tr><td>';
if (!empty($offerClient->c2o_cli)) {
$client = Client::model()->findByPk($offerClient->c2o_cli);
$data = $data . CHtml::link($client->fullName, Yii::app()->createUrl('admin4/client/update', ['id' => $offerClient->c2o_cli]));
}
$data = $data . '</td><td>';
$data = $data . CHtml::dropDownList('Offer[clientStatus][' . $client->cli_id . ']', $client->{$clientStatusType}, [0 => ''] + CHtml::listData(ClientStatus::model()->findAll(array('scopes' => array($instructionType))), 'cst_id', 'cst_title'), ['class' => 'input-xsmall']);
$data = $data . '</td><td>';
$data = $data . CHtml::link(CHtml::image(Yii::app()->params["imgUrl"] . "/sys/admin/icons/cross-icon.png", "Delete"), "#", ["onClick" => "deleteClient(" . $offerClient->c2o_id . ")"]);
$data = $data . '</td></tr>';
}
$data = $data . '</table>';
}
echo json_encode(array('html' => $data));
示例14: isset
<?php
/**
* @var $fixed boolean|null
* @see
*/
$pendSales = Client::model()->pendingCount("sales");
$pendLet = Client::model()->pendingCount("lettings");
$fixed = isset($fixed) ? $fixed : null;
$menu = array(['htmlOptions' => ['class' => 'header'], 'url' => Yii::app()->params['globalUrlOld'] . 'home.php', 'label' => 'Home Page'], 'separator', ['htmlOptions' => ['class' => 'header'], 'url' => Yii::app()->params['globalUrlOld'] . 'calendar.php', 'label' => 'Calendar'], ['htmlOptions' => [], 'url' => ['AppointmentBuilder/selectClient', 'for' => 'viewing'], 'label' => 'Arrange Viewing'], ['htmlOptions' => [], 'url' => ['instruction/vendorCare'], 'label' => 'Vendor Care'], ['htmlOptions' => [], 'url' => ['AppointmentBuilder/selectClient', 'for' => 'valuation'], 'label' => 'Arrange Valuation'], ['htmlOptions' => [], 'url' => ['Appointment/search'], 'label' => 'Search Calendar'], 'separator', ['htmlOptions' => [], 'url' => ['property/select'], 'label' => 'Property'], ['htmlOptions' => [], 'url' => ['instruction/search', AdminFilterForm::generateResetParam('instruction-filter-form') => 'true'], 'label' => 'Search Instruction'], ['htmlOptions' => [], 'url' => ['property/select'], 'label' => 'Search Property'], 'separator', ['htmlOptions' => ['class' => 'header'], 'url' => array('client/search'), 'label' => 'Clients'], ['htmlOptions' => [], 'url' => ['client/create'], 'label' => 'Add Client'], ['htmlOptions' => [], 'url' => ['client/newlyRegistered'], 'label' => 'Newly Registered'], ['htmlOptions' => [], 'url' => ['sms/incoming'], 'label' => 'Incoming Messages'], 'separator', ['htmlOptions' => ['class' => 'header'], 'url' => Yii::app()->params['globalUrlOld'] . 'contact.php', 'label' => 'Contacts'], ['htmlOptions' => [], 'url' => Yii::app()->params['globalUrlOld'] . 'contact_add.php', 'label' => 'New Contact'], ['htmlOptions' => [], 'url' => Yii::app()->params['globalUrlOld'] . 'company_add.php', 'label' => 'New Company'], 'separator', ['htmlOptions' => ['class' => 'header'], 'url' => Yii::app()->params['globalUrlOld'] . 'tools.php', 'label' => 'Tools'], 'separator', ['htmlOptions' => ['class' => 'header'], 'url' => '/admin/index.php', 'label' => 'Old Admin']);
if (Yii::app()->user->is("SuperAdmin")) {
$menu[] = 'separator';
$menu[] = ['htmlOptions' => ['class' => 'header', 'style' => 'color:red'], 'url' => array('SuperAdmin/'), 'label' => 'Super Admin'];
}
$menu[] = 'separator';
$menu[] = ['htmlOptions' => ['class' => 'header'], 'url' => '#', 'label' => 'Listing'];
$menu[] = ['htmlOptions' => [], 'url' => ['LocalEvent/'], 'label' => 'Local Events'];
$menu[] = ['htmlOptions' => [], 'url' => ['Place/'], 'label' => 'Parks'];
$menu[] = ['htmlOptions' => [], 'url' => ['Blog/'], 'label' => 'Blog'];
$menu[] = ['htmlOptions' => [], 'url' => ['PropertyCategory/'], 'label' => 'Property Category'];
$menu[] = ['htmlOptions' => [], 'url' => ['OuterLink/'], 'label' => 'Links'];
$menu[] = 'separator';
$menu[] = ['htmlOptions' => ['class' => 'header'], 'url' => '#', 'label' => 'Quick Reports'];
$menu[] = ['htmlOptions' => [], 'url' => ['QuickReport/instructionsWithoutEPC'], 'label' => 'Mising EPCs'];
$menu[] = ['htmlOptions' => [], 'url' => ['instruction/missedFollowUpReport'], 'label' => 'Missed Follow ups'];
$menu[] = ['htmlOptions' => [], 'url' => ['site/logout'], 'label' => 'Logout'];
?>
<div class="left-menu <?php
echo $fixed ? 'fixed' : '';
?>
">
示例15: actionGetClient
/** Lookup Client for autocomplete
*
* @throws CHttpException
*/
public function actionGetClient()
{
if (isset($_GET['term'])) {
$term = trim($_GET['term']);
$ret['results'] = Client::model()->select2Client($term);
//PHP Example · ivaynberg/select2 http://bit.ly/10FNaXD got stuck serveral hoursss :|
echo CJSON::encode($ret);
Yii::app()->end();
}
}