本文整理汇总了PHP中Client::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::save方法的具体用法?PHP Client::save怎么用?PHP Client::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Client
的用法示例。
在下文中一共展示了Client::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postCreate
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function postCreate()
{
// Declare the rules for the form validation
$rules = array('name' => 'required|min:3', 'description' => 'required|min:3', 'email' => 'required|min:3', 'callback' => 'required|min:3', 'website' => 'required|min:3');
// Validate the inputs
$validator = Validator::make(Input::all(), $rules);
// Check if the form validates with success
if ($validator->passes()) {
// Create a new blog post
$user = Auth::user();
// Update the blog post data
$this->client->name = Input::get('name');
$this->client->id = $this->keygen();
$this->client->secret = $this->keygen();
//$this->client->user_id = $user->id;
// Was the blog post created?
if ($this->client->save()) {
//Create Endpoint Object
$endpoint = new ClientEndpoint(array('redirect_uri' => Input::get('callback')));
$metadata = array(new ClientMetadata(array('key' => 'slug', 'value' => Str::slug(Input::get('name')))), new ClientMetadata(array('key' => 'description', 'value' => Str::slug(Input::get('description')))), new ClientMetadata(array('key' => 'email', 'value' => Str::slug(Input::get('email')))), new ClientMetadata(array('key' => 'website', 'value' => Str::slug(Input::get('website')))));
if (!$this->client->endpoint()->save($endpoint)) {
//delete client
$id = $this->client->id;
$this->client->delete();
// Was the blog post deleted?
$client = Client::find($id);
if (empty($client)) {
// Redirect to the blog post create page
return Redirect::to('admin/clients/create')->with('error', Lang::get('admin/clients/messages.create.endpoint_error'));
}
}
if (!$this->client->metadata()->saveMany($metadata)) {
//delete client
$id = $this->client->id;
$this->client->delete();
// Was the blog post deleted?
$client = Client::find($id);
if (empty($client)) {
// Redirect to the blog post create page
return Redirect::to('admin/clients/create')->with('error', Lang::get('admin/clients/messages.create.metadata_error'));
}
}
// Redirect to the new blog post page
return Redirect::to('admin/clients/' . $this->client->id . '/edit')->with('success', Lang::get('admin/clients/messages.create.success'));
}
// Redirect to the blog post create page
return Redirect::to('admin/clients/create')->with('error', Lang::get('admin/clients/messages.create.error'));
}
// Form validation failed
return Redirect::to('admin/clients/create')->withInput()->withErrors($validator);
}
示例2: actionCompleteRegistrationAjax
public function actionCompleteRegistrationAjax()
{
$client = new Client();
$client->attributes = $_POST['Client'];
if ($client->save()) {
$drive = new Drive();
$drive->attributes = $_POST['Drive'];
$drive->client_id = $client->primaryKey;
$drive->creation_date = date("Y-m-d H:i:s");
if ($drive->save()) {
$driv = Drive::model()->findByPk($drive->primaryKey);
$message = new YiiMailMessage();
$message->view = 'pruebamanejo';
$message->setBody(array("client" => $client, "drive" => $driv), 'text/html');
$message->setSubject('Solicitud Prueba de Manejo');
foreach ($driv->concessioner->emails as $email) {
// if($email->type=="DRIVE"){
if ($email->type == "QUOTATION") {
$message->addTo($email->description);
}
}
// $message->addTo("anaquishpe@ayasa.com.ec");
// $message->addTo("mgonzalez@ayasa.com.ec");
$message->addTo("gzumarraga@ayasa.com.ec");
$message->addTo("solicitudeswebnissan@gmail.com");
$message->setFrom(array(Yii::app()->params['adminEmail'] => 'El Equipo Nissan Ecuador'));
Yii::app()->mail->send($message);
echo json_encode(true);
} else {
echo json_encode(false);
}
}
}
示例3: saveClient
/**
* Save Client
*
* @param Client $client
* @throws DaoException
*/
public function saveClient(Client $client)
{
try {
$client->save();
} catch (Exception $e) {
throw new DaoException($e->getMessage(), $e->getCode(), $e);
}
}
示例4: save
public function save($con = null)
{
$c = new Client();
$c->setName($this->getValue("name"));
$c->setDepartment($this->getValue("department"));
$c->setAddress($this->getValue("address"));
$c->setEmail($this->getValue("email"));
$c->setPhone($this->getValue("phone"));
$c->save();
}
示例5: Create
public static function Create($name, $telephone, $idno, $email, $address, $bal, $details)
{
$type = new PartyType('Client');
$client = new Client($type, $name, $telephone, $idno, $email, $address, $bal, $details);
if ($client->save()) {
return $client;
} else {
return false;
}
}
示例6: actionIndex
/**
* This is the default 'index' action that is invoked
* when an action is not explicitly requested by users.
*/
public function actionIndex()
{
$client = new Client();
$vehicle = new VehicleClient();
$technicaldate = new TechnicalDate();
$concessioners = Concessioner::model()->findAll();
$criteria = new CDbCriteria();
//$criteria->condition = 'id != 32 AND id != 33 AND id != 34 AND id != 36 AND id != 37 AND id != 38 AND id != 39 AND id != 40 AND id != 41 AND id != 42';
//$criteria->order=name;
$criteria = new CDbCriteria();
//$criteria->condition = 'id != 36';
$criteria->order = "name";
$versions = VehicleVersion::model()->with('vehicle')->findAllbyAttributes(array(), $criteria);
//$versions= VehicleVersion::model()->findAllbyAttributes(array('status'=>'ACTIVE'),$criteria);
if (isset($_POST['ajax']) && $_POST['ajax'] === 'client-form') {
echo CActiveForm::validate($client);
Yii::app()->end();
}
if (isset($_POST['siguiente'])) {
// die("hola");
if (isset($_POST['Client']) && isset($_POST['TechnicalDate']) && isset($_POST['VehicleClient'])) {
//die("hola");
$client = new Client();
$client->attributes = $_POST['Client'];
$client->save();
$vehicle = new VehicleClient();
$vehicle->attributes = $_POST['VehicleClient'];
$vehicle->save();
$technicaldate = new TechnicalDate();
$technicaldate->attributes = $_POST['TechnicalDate'];
$technicaldate->client_id = $client->primaryKey;
$technicaldate->vehicle_id = $vehicle->primaryKey;
if ($technicaldate->save()) {
$message = new YiiMailMessage();
$message->view = 'agendamiento';
$message->setSubject('Prospecto agendamiento de Cita');
$message->setBody(array("client" => $client, "vehicle" => $vehicle, "technicaldate" => $technicaldate), 'text/html');
$message->setFrom(array(Yii::app()->params['adminEmail'] => 'El Equipo Nissan Ecuador'));
foreach ($technicaldate->concessioner->emails as $email) {
if ($email->type == "TECHNICAL_DATE") {
$message->addTo($email->description);
}
}
//$message->addTo("supervisorcallcenter@ayasa.com.ec");
Yii::app()->mail->send($message);
$this->render('result', array("client" => $client, "vehicle" => $vehicle, "technicaldate" => $technicaldate));
} else {
$this->render('error');
}
}
//$this->render('index',array('concessioners'=>$concessioners,"client"=>$client,"vehicle"=>$vehicle,"technicaldate"=>$technicaldate));
} else {
$this->render('index', array('concessioners' => $concessioners, "client" => $client, "vehicle" => $vehicle, "technicaldate" => $technicaldate, "versions" => $versions));
}
}
示例7: postSaveclient
public function postSaveclient()
{
$client = new Client();
$client->name = Input::get('name');
$client->email = Input::get('email');
$client->mobile = Input::get('mobile');
$client->city = Input::get('city');
$client->address1 = Input::get('address1');
$client->address2 = Input::get('address2');
$client->save();
return Response::json($client);
}
示例8: up
public function up()
{
(new \Lrs())->get()->each(function ($lrs) {
if (isset($lrs->api) && isset($lrs->api['basic_key']) && isset($lrs->api['basic_secret'])) {
$client = new \Client();
$client->api = $lrs->api;
$client->lrs_id = $lrs->_id;
$client->authority = ['name' => $lrs->title, 'mbox' => 'mailto:hello@learninglocker.net'];
$client->save();
}
});
}
示例9: actionRegistration
public function actionRegistration()
{
$model = new RegistrationForm();
if (!empty($_POST['RegistrationForm'])) {
$model->attributes = $_POST['RegistrationForm'];
if ($model->validate()) {
if (User::model()->exists('email=:email and status!=:status', array(':email' => $model->email, ':status' => L::r_item('userStatus', 'not_active')))) {
$model->addError('email', 'Пользователь с таким почтовым адресом уже зарегестрирован в нашей системе.');
} else {
// регистрация пошла, отпраляю почту и создаю пользователя со статусом "не активен"
Yii::import('ext.yii-mail.*');
$message = new YiiMailMessage();
$message->view = 'email_confirmation';
$message->setBody(array('hash' => sha1($model->email . Yii::app()->params['salt']), 'email' => $model->email, 'date' => date('YmdHis')), 'text/html');
$message->subject = Yii::app()->name . ' - Подтверждение почтового адреса/E-mail confirmation';
$message->addTo($model->email);
$message->from = Yii::app()->params['registrationEmail'];
if (Yii::app()->mail->send($message)) {
if (!($user = User::model()->find('email=:email', array(':email' => $model->email)))) {
$user = new User();
} else {
# надо удалить потеряного клиента
Client::model()->deleteByPk($user->username);
}
$user->username = $model->username;
$user->password = $model->password;
$user->password_confirm = $model->password_confirm;
$user->created = date('Y-m-d H:i:s');
$user->email = $model->email;
$user->city = $model->city;
$user->name = $model->name;
$user->status = L::r_item('userStatus', 'not_active');
if ($user->save()) {
if (!($client = Client::model()->find('username=:username', array(':username' => $user->username)))) {
$client = new Client();
}
# Добавляю клиента
$client->attributes = $model->attributes;
$client->card = Client::model()->find(array('select' => 'max(card) as maxCardNumber'))->maxCardNumber + 1;
$client->save();
Yii::app()->user->setFlash('registration', 'На указанный Вами e-mail было отправленно письмо с кодом подтверждения. Введите его.');
$this->redirect(array('users/confirmation'));
}
} else {
$model->addError('email', 'Мы не можем отправить почту на указаный Вами адрес.');
}
}
}
}
$model->password = null;
$model->password_confirm = null;
$this->render('registration', array('registration_form' => $model));
}
示例10: doSave
/**
* Performs the work of inserting or updating the row in the database.
*
* If the object is new, it inserts it; otherwise an update is performed.
* All related objects are also updated in this method.
*
* @param PropelPDO $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @throws PropelException
* @see save()
*/
protected function doSave(PropelPDO $con)
{
$affectedRows = 0;
// initialize var to track total num of affected rows
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
// We call the save method on the following object(s) if they
// were passed to this object by their coresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
if ($this->aElement !== null) {
if ($this->aElement->isModified() || $this->aElement->isNew()) {
$affectedRows += $this->aElement->save($con);
}
$this->setElement($this->aElement);
}
if ($this->aOrderStatus !== null) {
if ($this->aOrderStatus->isModified() || $this->aOrderStatus->isNew()) {
$affectedRows += $this->aOrderStatus->save($con);
}
$this->setOrderStatus($this->aOrderStatus);
}
if ($this->aClient !== null) {
if ($this->aClient->isModified() || $this->aClient->isNew()) {
$affectedRows += $this->aClient->save($con);
}
$this->setClient($this->aClient);
}
if ($this->isNew()) {
$this->modifiedColumns[] = OrderPeer::ID;
}
// If this object has been modified, then save it to the database.
if ($this->isModified()) {
if ($this->isNew()) {
$pk = OrderPeer::doInsert($this, $con);
$affectedRows += 1;
// we are assuming that there is only 1 row per doInsert() which
// should always be true here (even though technically
// BasePeer::doInsert() can insert multiple rows).
$this->setId($pk);
//[IMV] update autoincrement primary key
$this->setNew(false);
} else {
$affectedRows += OrderPeer::doUpdate($this, $con);
}
$this->resetModified();
// [HL] After being saved an object is no longer 'modified'
}
$this->alreadyInSave = false;
}
return $affectedRows;
}
示例11: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Client();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Client'])) {
$model->attributes = $_POST['Client'];
if ($model->save()) {
$this->redirect(array('view', 'id' => $model->username));
}
}
$this->render('create', array('model' => $model));
}
示例12: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$client = new Client();
$client->company = Input::get('company');
$client->street_address = Input::get('street_address');
$client->city = Input::get('city');
$client->state = Input::get('state');
$client->zip = Input::get('zip');
$client->website = Input::get('website');
$client->notes = Input::get('notes');
$client->save();
Flash::message('Client Added!');
return Redirect::route('add_client')->with('flash_message', 'Client Added!');
}
示例13: setUp
public function setUp()
{
Yii::app()->db->createCommand()->truncateTable('link_client_to_instruction');
Yii::app()->db->createCommand()->truncateTable('property');
Yii::app()->db->createCommand()->truncateTable('deal');
Yii::app()->db->createCommand()->truncateTable('client');
Yii::app()->db->createCommand()->truncateTable('currentPropertyOwner');
Yii::app()->db->createCommand()->truncateTable('cli2off');
Yii::app()->db->createCommand()->truncateTable('offer');
$this->migration = new m121127_103823_populate_currentPropertyOwners_table();
$this->migration->down();
$this->property = new Property();
$this->property->save(false);
$this->assertInstanceOf('Property', $this->property);
$this->owner1 = new Client();
$this->owner1->save(false);
$this->owner2 = new Client();
$this->owner2->save(false);
$this->owner3 = new Client();
$this->owner3->save(false);
$this->owner4 = new Client();
$this->owner4->save(false);
}
示例14: store
/**
* Store a newly created client in storage.
*
* @return Response
*/
public function store()
{
$validator = Validator::make($data = Input::all(), Client::$rules);
$user = Auth::user();
if ($validator->passes()) {
// store the client data
$this->client->name = Input::get('name');
$this->client->address_1 = Input::get('address_1');
$this->client->address_2 = Input::get('address_2');
$this->client->city = Input::get('city');
$this->client->zip = Input::get('zip');
$this->client->state = Input::get('state');
$this->client->country_id = Input::get('country_id');
$this->client->phone = Input::get('phone');
$this->client->mobile = Input::get('mobile');
$this->client->fax = Input::get('fax');
$this->client->email = Input::get('email');
$this->client->web = Input::get('web');
$this->client->user_id = $user->id;
if (Input::hasFile('logo')) {
$file = Input::file('logo');
$thumbnail = Image::make($file->getRealPath())->crop(200, 80);
$destinationPath = 'uploads/' . $user->username . "/clients/";
$filename_string = sha1(time() . time() . $file->getClientOriginalName());
$filename = $filename_string . "." . $file->getClientOriginalExtension();
$filename_thumb = $filename_string . "_thumb" . "." . $file->getClientOriginalExtension();
if (!File::exists($destinationPath)) {
mkdir($destinationPath, 0777, true);
}
$upload_success = Input::file('logo')->move($destinationPath, $filename) && $thumbnail->save($destinationPath . "/" . $filename_thumb);
if ($upload_success) {
$this->client->image_name = $file->getClientOriginalName();
$this->client->image_path = $destinationPath . $filename;
$this->client->image_path_thumbnail = $destinationPath . $filename_thumb;
}
}
if ($this->client->save()) {
$this->client->user_id = $user->id;
if (Request::ajax()) {
return Response::json(array('status' => 'success'));
}
return Redirect::to('clients/' . $this->client->id . '/edit')->with('success', Lang::get('client.message.success.create'));
}
}
if (Request::ajax()) {
return Response::json(array('status' => 'error', 'errors' => $validator->errors()->toArray()));
}
return Redirect::back()->withErrors($validator)->withInput();
}
示例15: save
function save()
{
$id = $this->input->post("id");
if ($id == 0) {
$clientObject = new Client();
} else {
$clientObject = new Client($id);
}
$clientObject->name = $this->input->post("name", TRUE);
$clientObject->address = $this->input->post("address", TRUE);
$clientObject->number = $this->input->post("number", TRUE);
$clientObject->email = $this->input->post("email", TRUE);
$clientObject->save();
echo $clientObject->id;
}