当前位置: 首页>>代码示例>>PHP>>正文


PHP Contacts::save方法代码示例

本文整理汇总了PHP中Contacts::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Contacts::save方法的具体用法?PHP Contacts::save怎么用?PHP Contacts::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Contacts的用法示例。


在下文中一共展示了Contacts::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save

 public function save()
 {
     $this->load->model('contacts');
     $contact = new Contacts();
     $contact->id = 1;
     $contact->name = $this->input->post('name');
     $contact->number = $this->input->post('number');
     $contact->city = $this->input->post('city');
     if ($contact->save()) {
         die('Saved');
     }
 }
开发者ID:phpTomysql,项目名称:ci-hmvce,代码行数:12,代码来源:contactbook.php

示例2: AddNew

 /**
  * Add a new contact
  * @param $id
  * @param array $data
  * @return integer contact_id
  */
 public static function AddNew(array $data, $id = "")
 {
     if (is_numeric($id)) {
         $contact = self::find($id);
     } else {
         $contact = new Contacts();
     }
     $contact['contact'] = $data['contact'];
     $contact['type_id'] = $data['type_id'];
     $contact['customer_id'] = $data['customer_id'];
     $contact->save();
     return $contact['contact_id'];
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:19,代码来源:Contacts.php

示例3: createContact

 private function createContact($con)
 {
     $con_model = new \Contacts();
     $con_model->attributes = $con;
     $con_model->ID_user = $this->tiUser->ID;
     try {
         if (!$con_model->save()) {
             new \Error(5, null, json_encode($con_model->getErrors()));
         }
     } catch (Exception $e) {
         new \Error(5, null, $e->getMessage());
     }
 }
开发者ID:Yougmark,项目名称:TiCheck_Server,代码行数:13,代码来源:AddController.php

示例4: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $this->layout = 'main';
     $model = new Contacts();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Contacts'])) {
         $model->attributes = $_POST['Contacts'];
         $model->date = new CDbExpression('NOW()');
         if ($model->save()) {
             $notif = Yii::app()->getComponent('user');
             $notif->setFlash('success', "<strong>Message successfully send!</strong>");
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:lajayuhniyarsyah,项目名称:SupraCompProfile,代码行数:20,代码来源:ContactsController.php

示例5: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Contacts();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Contacts'])) {
         $model->attributes = $_POST['Contacts'];
         if ($model->save()) {
             $msg = 'Контакт #' . $model->id . ' - ' . $model->name . ' создан';
             Yii::app()->user->setFlash('success', $msg);
             Yii::app()->logger->write($msg);
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:ASDAFF,项目名称:its-crm,代码行数:20,代码来源:ContactsController.php

示例6: actionSendContact

 public function actionSendContact()
 {
     $model = new Contacts();
     if (isset($_POST['Contacts'])) {
         $model->attributes = $_POST['Contacts'];
         $model->date = new CDbExpression('NOW()');
         if ($model->save()) {
             echo 'Thank you for contacting us. We will respond to you as soon as possible.';
         } else {
             echo 'Send contact failed, please fix some error:';
             foreach ($model->errors as $err) {
                 echo '<br>' . ' - ' . $err[0];
             }
         }
     } else {
         echo 'Error ';
     }
 }
开发者ID:lajayuhniyarsyah,项目名称:SupraCompProfile,代码行数:18,代码来源:SiteController.php

示例7: actionQuickContact

 /**
  * Method of creating a Contact called by the Quick Create widget
  */
 public function actionQuickContact()
 {
     $model = new Contacts();
     // collect user input data
     if (isset($_POST['Contacts'])) {
         // clear values that haven't been changed from the default
         //$temp=$model->attributes;
         $model->setX2Fields($_POST['Contacts']);
         $model->visibility = 1;
         // validate user input and save contact
         // $changes = $this->calculateChanges($temp, $model->attributes, $model);
         // $model = $this->updateChangelog($model, $changes);
         $model->createDate = time();
         //if($model->validate()) {
         if ($model->save()) {
         } else {
             //echo CHtml::errorSummary ($model);
             echo CJSON::encode($model->getErrors());
         }
         return;
         //}
         //echo '';
         //echo CJSON::encode($model->getErrors());
     }
     $this->renderPartial('application.components.views.quickContact', array('model' => $model));
 }
开发者ID:shuvro35,项目名称:X2CRM,代码行数:29,代码来源:ContactsController.php

示例8: importExcel

 private function importExcel($file)
 {
     $fp = fopen($file, 'r+');
     $meta = fgetcsv($fp);
     while ($arr = fgetcsv($fp)) {
         $model = new Contacts();
         $attributes = array_combine($meta, $arr);
         foreach ($attributes as $attribute => $value) {
             if (array_search($attribute, array_keys($model->attributes)) !== false) {
                 $model->{$attribute} = $value;
             }
         }
         if ($model->save()) {
         }
     }
     unlink($file);
     $this->redirect('index');
 }
开发者ID:netconstructor,项目名称:X2Engine,代码行数:18,代码来源:DefaultController.php

示例9: array

 $key = array_rand($street_address_array);
 $contact->column_fields["mailingstreet"] = $street_address_array[$key];
 $key = array_rand($city_array);
 $contact->column_fields["mailingcity"] = $city_array[$key];
 $contact->column_fields["mailingstate"] = "CA";
 $contact->column_fields["mailingzip"] = '99999';
 $contact->column_fields["mailingcountry"] = 'USA';
 $key = array_rand($comboFieldArray['leadsource_dom']);
 $contact->column_fields["leadsource"] = $comboFieldArray['leadsource_dom'][$key];
 $titles = array("President", "VP Operations", "VP Sales", "Director Operations", "Director Sales", "Mgr Operations", "IT Developer", "");
 $key = array_rand($titles);
 $contact->column_fields["title"] = $titles[$key];
 $account_key = array_rand($account_ids);
 $contact->column_fields["account_id"] = $account_ids[$account_key];
 //$contact->saveentity("Contacts");
 $contact->save("Contacts");
 $contact_ids[] = $contact->id;
 if ($i > 8) {
     $freetag = $adb->getUniqueId('vtiger_freetags');
     $query = "insert into vtiger_freetags values (?,?,?)";
     $qparams = array($freetag, $cloudtag[2], $cloudtag[2]);
     $res1 = $adb->pquery($query, $qparams);
     $date = $adb->formatDate(date('YmdHis'), true);
     $query_tag = "insert into vtiger_freetagged_objects values (?,?,?,?,?)";
     $tag_params = array($freetag, 1, $contact->id, $date, 'Contacts');
     $result1 = $adb->pquery($query_tag, $tag_params);
 }
 // This assumes that there will be one opportunity per company in the seed data.
 $opportunity_key = array_rand($opportunity_ids);
 $query = "insert into vtiger_contpotentialrel ( contactid, potentialid ) values (?,?)";
 $adb->pquery($query, array($contact->id, $opportunity_ids[$opportunity_key]));
开发者ID:nvh3010,项目名称:quancrm,代码行数:31,代码来源:PopulateSeedData.php

示例10: add_attachment_to_contact

    if ($email->relationship["type"] == "Contacts") {
        add_attachment_to_contact($email->relationship["id"], $email, $focus->id);
    }
} else {
    //if relationship is not available create a contact and relate the email to the contact
    require_once 'modules/Contacts/Contacts.php';
    $contact_focus = new Contacts();
    //Populate the lastname as emailid if email doesn't have from name
    if ($email->fromname) {
        $contact_focus->column_fields['lastname'] = $email->fromname;
    } else {
        $contact_focus->column_fields['lastname'] = $email->from;
    }
    $contact_focus->column_fields['email'] = $email->from;
    $contact_focus->column_fields["assigned_user_id"] = $current_user->id;
    $contact_focus->save("Contacts");
    $focus->column_fields['parent_id'] = $contact_focus->id . '@' . $fieldid . '|';
    $focus->save("Emails");
    add_attachment_to_contact($contact_focus->id, $email, $focus->id);
}
function add_attachment_to_contact($cid, $email, $emailid)
{
    // add vtiger_attachments to contact
    global $adb, $current_user, $default_charset;
    for ($j = 0; $j < 2; $j++) {
        if ($j == 0) {
            $attachments = $email->downloadAttachments();
        } else {
            $attachments = $email->downloadInlineAttachments();
        }
        $upload_filepath = decideFilePath();
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:31,代码来源:Save.php

示例11: actionSave

 public function actionSave()
 {
     $response = array('status' => 'failed');
     if (Yii::app()->request->isAjaxRequest) {
         if (isset($_POST['datas']) and $_POST['datas'] != "" and isset($_POST['import_fields']) and count($_POST['import_fields']) > 0) {
             $datas = json_decode($_POST['datas']);
             $fields = $_POST['import_fields'];
             $start = 1;
             $singlequery = false;
             $inserted_rows = 0;
             $requiredattributes = array();
             if (Contacts::model()->import_contacts_config()) {
                 $import_config = Contacts::model()->import_contacts_config();
                 if ($import_config['required_attributes']) {
                     $requiredattributes = $import_config['required_attributes'];
                 }
             }
             $valid = true;
             foreach ($fields as $field => $value) {
                 if (in_array($field, $requiredattributes) and $value == NULL) {
                     $valid = false;
                 }
             }
             if (!$valid) {
                 $response['data'] = $this->renderPartial('import/_error', array('error' => 2), true);
             } else {
                 while ($start < count($datas)) {
                     if (!$singlequery) {
                         $contact = new Contacts();
                         $contact->created_by = Yii::app()->user->id;
                         $contact->created_at = date('Y-m-d H:i:s');
                         $contact->status = 1;
                         foreach ($fields as $field => $value) {
                             if ($value != NULL) {
                                 $contact->{$field} = $datas[$start][$value];
                             }
                         }
                         if ($contact->save()) {
                             $inserted_rows++;
                             if (isset($_POST['groups']) and count($_POST['groups']) > 0) {
                                 foreach ($_POST['groups'] as $group) {
                                     $list = new ContactsList();
                                     $list->contact_id = $contact->id;
                                     $list->group_id = $group;
                                     $list->save();
                                 }
                             }
                         }
                     }
                     $start++;
                 }
                 $response['status'] = "success";
                 $response['data'] = $this->renderPartial('import/_step3', array('inserted_rows' => $inserted_rows, 'total_rows' => count($datas) - 1), true);
             }
         }
     }
     echo json_encode($response);
     Yii::app()->end();
 }
开发者ID:akilraj1255,项目名称:rajeshwari,代码行数:59,代码来源:ContactsController.php

示例12: createContactAction

 public function createContactAction()
 {
     if ($this->request->isPost() == true) {
         try {
             $this->response->setContentType('application/json');
             $user_id = $this->request->getPost('user_id');
             $email = $this->request->getPost('email');
             $number = $this->request->getPost('number', 'striptags');
             $contact_name = $this->request->getPost('contact_name');
             $address = $this->request->getPost('address');
             if ($email == '' || $email == null) {
                 $email = null;
             }
             $contact = new Contacts();
             $msg = 'contact created';
             $contact_data = array('contact_name' => $contact_name, 'email' => $email, 'number' => $number, 'address' => $address, 'user_id' => $user_id, 'msg' => $msg);
             $contact->assign(array('name' => $contact_name, 'number' => $number, 'user_id' => $user_id, 'email' => $email, 'address' => $address, 'updated_at' => date("Y-m-d H:i:s"), 'created_at' => date("Y-m-d H:i:s")));
             if ($contact->save()) {
                 $data = array('status' => 'success', 'msg' => $msg, 'code' => 2);
             } else {
                 $data = $this->updateContact($contact_data);
             }
         } catch (Exception $ex) {
             $data = $this->updateContact($contact_data);
         }
         $this->response->setContent(json_encode($data));
         $this->response->send();
     }
 }
开发者ID:adeshhashbyte,项目名称:smhawkapi,代码行数:29,代码来源:UserController.php

示例13: admin_settings

 public function admin_settings()
 {
     if (count($this->_managerImages) != 0) {
         foreach ($this->_managerImages as $file) {
             if ($file->name != '') {
                 $imageExtention = pathinfo($file->getName(), PATHINFO_EXTENSION);
                 $imageName = substr(md5($file->name . microtime()), 0, 28) . '.' . $imageExtention;
                 $image = Yii::app()->image->load($file->tempName);
                 $image->resize(self::$image_w, self::$image_h);
                 $image->save('./uploads/' . $imageName);
                 $this->manager_image = $imageName;
             }
             break;
         }
     }
     Contacts::model()->deleteAll();
     if (count($_POST['contacts_title_ru']) != 0) {
         foreach ($_POST['contacts_title_ru'] as $key => $c) {
             $contacts = new Contacts();
             $contacts->title_ru = trim($_POST['contacts_title_ru'][$key]);
             $contacts->title_en = trim($_POST['contacts_title_en'][$key]);
             $contacts->title_es = trim($_POST['contacts_title_es'][$key]);
             $contacts->value = trim($_POST['contacts_value'][$key]);
             $contacts->save();
         }
     }
     ManagerContacts::model()->deleteAll();
     if (count($_POST['managerContacts_title_ru']) != 0) {
         foreach ($_POST['managerContacts_title_ru'] as $key => $c) {
             $managerContacts = new ManagerContacts();
             $managerContacts->title_ru = trim($_POST['managerContacts_title_ru'][$key]);
             $managerContacts->title_en = trim($_POST['managerContacts_title_en'][$key]);
             $managerContacts->title_es = trim($_POST['managerContacts_title_es'][$key]);
             $managerContacts->value = trim($_POST['managerContacts_value'][$key]);
             $managerContacts->save();
         }
     }
     if ($this->save(false)) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:postfx,项目名称:fermion,代码行数:43,代码来源:_Config.php

示例14: microtime

include_once 'build/cbHeader.inc';
require_once 'modules/Contacts/Contacts.php';
$time_elapsed_us = microtime(true) - $start;
echo "Load time: {$time_elapsed_us}\n";
$num2create = 100;
$_REQUEST['assigntype'] == 'U';
$recs2del = array();
$start = microtime(true);
for ($i = 0; $i < $num2create; $i++) {
    $focus = new Contacts();
    $focus->column_fields['firstname'] = 'firstname' . $i;
    $focus->column_fields['lastname'] = 'lastname' . $i;
    $focus->email_opt_out = 'off';
    $focus->do_not_call = 'off';
    $focus->column_fields['assigned_user_id'] = $current_user->id;
    $focus->save("Contacts");
    $recs2del[] = $focus->id;
    if ($i % 10 == 0) {
        echo $i . "\n";
        foreach ($recs2del as $c) {
            $f2 = new Contacts();
            $f2->retrieve_entity_info($c, 'Contacts');
            DeleteEntity('Contacts', 'Contacts', $f2, $c, $c);
        }
        $recs2del = array();
    }
}
foreach ($recs2del as $c) {
    $f2 = new Contacts();
    $f2->retrieve_entity_info($c, 'Contacts');
    DeleteEntity('Contacts', 'Contacts', $f2, $c, $c);
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:31,代码来源:stressTest.php

示例15: create_contact1

function create_contact1($user_name, $first_name, $last_name, $email_address, $account_name, $salutation, $title, $phone_mobile, $reports_to, $primary_address_street, $primary_address_city, $primary_address_state, $primary_address_postalcode, $primary_address_country, $alt_address_city, $alt_address_street, $alt_address_state, $alt_address_postalcode, $alt_address_country, $office_phone, $home_phone, $other_phone, $fax, $department, $birthdate, $assistant_name, $assistant_phone, $description = '')
{
    global $adb, $log;
    global $current_user;
    require_once 'modules/Users/Users.php';
    $seed_user = new Users();
    $user_id = $seed_user->retrieve_user_id($user_name);
    $current_user = $seed_user;
    $current_user->retrieve_entity_info($user_id, 'Users');
    require_once 'modules/Contacts/Contacts.php';
    if (isPermitted("Contacts", "EditView") == "yes") {
        $contact = new Contacts();
        $contact->column_fields[firstname] = $first_name;
        $contact->column_fields[lastname] = $last_name;
        //$contact->column_fields[account_id]=retrieve_account_id($account_name,$user_id);// NULL value is not supported NEED TO FIX
        $contact->column_fields[salutation] = $salutation;
        // EMAIL IS NOT ADDED
        $contact->column_fields[title] = $title;
        $contact->column_fields[email] = $email_address;
        $contact->column_fields[mobile] = $phone_mobile;
        //$contact->column_fields[reports_to_id] =retrievereportsto($reports_to,$user_id,$account_id);// NOT FIXED IN SAVEENTITY.PHP
        $contact->column_fields[mailingstreet] = $primary_address_street;
        $contact->column_fields[mailingcity] = $primary_address_city;
        $contact->column_fields[mailingcountry] = $primary_address_country;
        $contact->column_fields[mailingstate] = $primary_address_state;
        $contact->column_fields[mailingzip] = $primary_address_postalcode;
        $contact->column_fields[otherstreet] = $alt_address_street;
        $contact->column_fields[othercity] = $alt_address_city;
        $contact->column_fields[othercountry] = $alt_address_country;
        $contact->column_fields[otherstate] = $alt_address_state;
        $contact->column_fields[otherzip] = $alt_address_postalcode;
        $contact->column_fields[assigned_user_id] = $user_id;
        // new Fields
        $contact->column_fields[phone] = $office_phone;
        $contact->column_fields[homephone] = $home_phone;
        $contact->column_fields[otherphone] = $other_phone;
        $contact->column_fields[fax] = $fax;
        $contact->column_fields[department] = $department;
        $contact->column_fields[birthday] = DateTimeField::convertToUserFormat($birthdate);
        $contact->column_fields[assistant] = $assistant_name;
        $contact->column_fields[assistantphone] = $assistant_phone;
        $contact->column_fields[description] = $description;
        $contact->save("Contacts");
        if ($contact->id != '') {
            return 'Contact added successfully';
        } else {
            return "Contact creation failed. Try again";
        }
    } else {
        return $accessDenied;
    }
}
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:52,代码来源:firefoxtoolbar.php


注:本文中的Contacts::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。