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


PHP Phone::save方法代码示例

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


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

示例1: add_telefono

 public function add_telefono()
 {
     $inputs = Input::all();
     $rules = array('telefono' => 'required|numeric|unique:telefono,telefono', 'telefono_secundario' => 'numeric', 'telefono_fax' => 'numeric');
     $validator = Validator::make($inputs, $rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator);
     } else {
         $telefono = new Phone();
         $telefono->telefono = Input::get('telefono');
         $telefono->telefono_secundario = Input::get('telefono_secundario');
         $telefono->telefono_fax = Input::get('telefono_fax');
         if (Input::get('fk_persona') != 'NULL') {
             $telefono->fk_persona = Input::get('fk_persona');
             $telefono->fk_empresa = NULL;
             $telefono->save();
             return Redirect::to('telefono');
         } else {
             $telefono->fk_empresa = Input::get('fk_empresa');
             $telefono->fk_persona = NULL;
             $telefono->save();
             return Redirect::to('telefono');
         }
         return Redirect::to('telefono');
     }
 }
开发者ID:bmrpas,项目名称:SHREDDER,代码行数:26,代码来源:TelefonoController.php

示例2: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Phone();
     if (isset($_GET['Phone']['city_id'])) {
         if (!empty($_GET['Phone']['city_id'])) {
             $model->city_id = $_GET['Phone']['city_id'];
         }
     }
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Phone'])) {
         $model->attributes = $_POST['Phone'];
         $model->city_id = $_GET['Phone']['city_id'];
         if ($model->save()) {
             //$city = City::model()->findByPk($model->city_id);
             //после добавления связки - номер/шаблон, обновим статус у города, если надо, что он подвязан к шаблону
             $query = YiiBase::app()->db->createCommand('UPDATE tbl_city_site_phone SET relation_tpl=1 WHERE city_id=:city_id AND site_id=:site_id');
             $query->bindValue(':site_id', $model->site_id, PDO::PARAM_INT);
             $query->bindValue(':city_id', $model->city_id, PDO::PARAM_INT);
             $query->execute();
             $this->redirect(array('index', 'Phone[city_id]' => $model->city_id));
         }
     } else {
         if (isset($_GET['Phone'])) {
             $model->attributes = $_GET['Phone'];
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:juniorspecialist,项目名称:phone_theservice,代码行数:33,代码来源:PhoneController.php

示例3: actionCreate

 public function actionCreate()
 {
     $model = new Phone();
     if (isset($_POST['Phone'])) {
         $model->setAttributes($_POST['Phone']);
         if ($model->save()) {
             if (Yii::app()->getRequest()->getIsAjaxRequest()) {
                 Yii::app()->end();
             } else {
                 $this->redirect(array('view', 'id' => $model->id));
             }
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:hanihh,项目名称:vvs_v2,代码行数:15,代码来源:PhoneController.php

示例4: handleCreate

 public function handleCreate()
 {
     DB::transaction(function () {
         $input = Input::all();
         $person = new Person();
         $localizationController = new LocalizationController();
         $person->names = $input['names'];
         $person->last_name = $input['last_name'];
         $person->doc_number = $input['doc_number'];
         $person->doc_type = $input['doc_type'];
         $person->email = $input['email'];
         $person->career = $input['career'];
         $person->state = 1;
         //para transformar a fecha
         $borndate = date("Y-m-d", strtotime($input['born_date']));
         $person->born_date = $borndate;
         $person->nationality = $input['nationality'];
         $person->academicdegree_id = $input['academicdegree_id'];
         $person->localization_id = $localizationController->getLocalizationId($input['localization_dept'], $input['localization_prov'], $input['localization_dist']);
         $person->save();
         $i = 0;
         foreach ($input['mobile_number'] as $mobil) {
             $phone = new Phone();
             $phone->person()->associate($person);
             $phone->mobile_number = $mobil;
             $phone->type = $input['phone_type'][$i];
             $phone->save();
             $i = $i + 1;
         }
         if (isset($input['notif1'])) {
             //asociar la persona a las notificaciones de tipo 1
             //$person->notifications()->save(Notification::find(1));
             $person->notifications()->attach(1);
             $person->notifications()->where('person_id', '=', $person->id)->update(array('state' => 1));
         }
         if (isset($input['notif2'])) {
             //asociar la persona a las notificaciones de tipo 1
             $person->notifications()->attach(2);
             $person->notifications()->where('person_id', '=', $person->id)->update(array('state' => 1));
         }
     });
     return Redirect::to('registro');
 }
开发者ID:alfonsobp,项目名称:elprofeweb,代码行数:43,代码来源:PersonController.php

示例5: add_phone_number

 /**
  * Добавляет юзеру номер телефона, принимая объект номера телефона,
  * ассоциативный массив с кодом страны, кодом оператора и т.д. или
  * строку с неформатированым номером телефона.
  * Сохраняет телефонный номер в бд и возвращает его в случае успеха или
  * false при неудаче 
  */
 public function add_phone_number($phone)
 {
     if (gettype($phone) === 'array') {
         $phone = new Phone($phone);
     } else {
         if (gettype($phone) === 'string') {
             $params = array();
             $params['country_code'] = substr($phone, 0, 3);
             $params['operator_code'] = substr($phone, 3, -7);
             $params['phone_number'] = substr($phone, 5);
             $phone = new Phone($params);
         }
     }
     $phone->user_id = $this->id;
     if ($phone->save()) {
         $this->phones[] = $phone;
         return $phone;
     }
     return false;
 }
开发者ID:nomid,项目名称:forforce,代码行数:27,代码来源:user.php

示例6: printf

if ($skipped != 0) {
    printf("\n%u addresses skipped.\n", $skipped);
}
if ($fixed != 0) {
    printf("\n%u addresses fixed.\n", $fixed);
}
print "\nAddress formating done.\n\n";
print "Formats non formated phones. (3/4)\n";
$it = XDB::rawIterator("SELECT  search_tel AS search, display_tel AS display, comment, link_id,\n                                tel_type AS type, link_type, tel_id AS id, pid, pub\n                          FROM  profile_phones\n                         WHERE  search_tel = '' OR search_tel IS NULL\n                      ORDER BY  pid, link_id, tel_id");
$total = $it->total();
$i = 0;
$j = 0;
while ($item = $it->next()) {
    $phone = new Phone($item);
    $phone->delete();
    $phone->save();
    ++$i;
    ++$j;
    if ($j == 100) {
        $j = 0;
        printf("\r%u / %u", $i, $total);
    }
}
printf("\r%u / %u", $i, $total);
print "\nFormating done.\n\n";
print "Deletes duplicated phones. (4/4)\n";
$pids = XDB::rawFetchColumn("SELECT  DISTINCT(pid)\n                               FROM  profile_phones AS p1\n                              WHERE  link_type = 'user' AND EXISTS (SELECT  *\n                                                                      FROM  profile_phones AS p2\n                                                                     WHERE  p2.link_type = 'user' AND p2.pid = p1.pid AND p2.tel_id != p1.tel_id)\n                           ORDER BY  pid");
$total = count($pids);
$done = 0;
$aux = 0;
$deleted = 0;
开发者ID:Ekleog,项目名称:platal,代码行数:31,代码来源:merge_issues.php

示例7: CONCAT

 function handler_jobs($page, $id = -1)
 {
     $page->changeTpl('admin/jobs.tpl');
     if (Env::has('search')) {
         $res = XDB::query("SELECT  id, name, acronym\n                                 FROM  profile_job_enum\n                                WHERE  name LIKE CONCAT('%', {?}, '%') OR acronym LIKE CONCAT('%', {?}, '%')", Env::t('job'), Env::t('job'));
         if ($res->numRows() <= 20) {
             $page->assign('jobs', $res->fetchAllAssoc());
         } else {
             $page->trigError("Il y a trop d'entreprises correspondant à ton choix. Affine-le !");
         }
         $page->assign('askedJob', Env::v('job'));
         return;
     }
     if (Env::has('edit')) {
         S::assert_xsrf_token();
         $selectedJob = Env::has('selectedJob');
         Phone::deletePhones(0, Phone::LINK_COMPANY, $id);
         Address::deleteAddresses(null, Address::LINK_COMPANY, $id);
         if (Env::has('change')) {
             if (Env::has('newJobId') && Env::i('newJobId') > 0) {
                 XDB::execute('UPDATE  profile_job
                                  SET  jobid = {?}
                                WHERE  jobid = {?}', Env::i('newJobId'), $id);
                 XDB::execute('DELETE FROM  profile_job_enum
                                     WHERE  id = {?}', $id);
                 $page->trigSuccess("L'entreprise a bien été remplacée.");
             } else {
                 $page->trigError("L'entreprise n'a pas été remplacée car l'identifiant fourni n'est pas valide.");
             }
         } else {
             XDB::execute('UPDATE  profile_job_enum
                              SET  name = {?}, acronym = {?}, url = {?}, email = {?},
                                   SIREN_code = {?}, NAF_code = {?}, AX_code = {?}, holdingid = {?}
                            WHERE  id = {?}', Env::t('name'), Env::t('acronym'), Env::t('url'), Env::t('email'), Env::t('SIREN') == 0 ? null : Env::t('SIREN'), Env::t('NAF_code') == 0 ? null : Env::t('NAF_code'), Env::i('AX_code') == 0 ? null : Env::t('AX_code'), Env::i('holdingId') == 0 ? null : Env::t('holdingId'), $id);
             $phone = new Phone(array('display' => Env::v('tel'), 'link_id' => $id, 'id' => 0, 'type' => 'fixed', 'link_type' => Phone::LINK_COMPANY, 'pub' => 'public'));
             $fax = new Phone(array('display' => Env::v('fax'), 'link_id' => $id, 'id' => 1, 'type' => 'fax', 'link_type' => Phone::LINK_COMPANY, 'pub' => 'public'));
             $address = new Address(array('jobid' => $id, 'type' => Address::LINK_COMPANY, 'text' => Env::t('address')));
             $phone->save();
             $fax->save();
             $address->save();
             $page->trigSuccess("L'entreprise a bien été mise à jour.");
         }
     }
     if (!Env::has('change') && $id != -1) {
         $res = XDB::query("SELECT  e.id, e.name, e.acronym, e.url, e.email, e.SIREN_code AS SIREN, e.NAF_code, e.AX_code,\n                                       h.id AS holdingId, h.name AS holdingName, h.acronym AS holdingAcronym,\n                                       t.display_tel AS tel, f.display_tel AS fax, a.text AS address\n                                 FROM  profile_job_enum  AS e\n                            LEFT JOIN  profile_job_enum  AS h ON (e.holdingid = h.id)\n                            LEFT JOIN  profile_phones    AS t ON (t.pid = e.id AND t.link_type = 'hq' AND t.tel_id = 0)\n                            LEFT JOIN  profile_phones    AS f ON (f.pid = e.id AND f.link_type = 'hq' AND f.tel_id = 1)\n                            LEFT JOIN  profile_addresses AS a ON (a.jobid = e.id AND a.type = 'hq')\n                                WHERE  e.id = {?}", $id);
         if ($res->numRows() == 0) {
             $page->trigError('Auncune entreprise ne correspond à cet identifiant.');
         } else {
             $page->assign('selectedJob', $res->fetchOneAssoc());
         }
     }
 }
开发者ID:Ekleog,项目名称:platal,代码行数:52,代码来源:admin.php

示例8: findPerson

 /**
  * Try to find this person in the database.
  * If we cannot find them, create a new person record.
  *
  * @return Person
  */
 public static function findPerson($post)
 {
     $search = array();
     // Translates Open311 parameters into PersonList search parameters
     // open311 => personList
     $fields = array('first_name' => 'firstname', 'last_name' => 'lastname', 'email' => 'email', 'phone' => 'phoneNumber', 'device_id' => 'phoneDeviceId');
     foreach ($fields as $open311Field => $crmField) {
         if (!empty($post[$open311Field])) {
             $search[$crmField] = $post[$open311Field];
         }
     }
     // If the user provided any personal info, do a person search
     if (count($search)) {
         $table = new PersonTable();
         $list = $table->find($search);
         // When we find one and only one record, use the record we found
         if (count($list) == 1) {
             $person = $list->current();
         } else {
             $p = array();
             foreach ($fields as $key => $field) {
                 if (!empty($post[$key])) {
                     $p[$field] = $post[$key];
                 }
             }
             if (count($p)) {
                 $person = new Person();
                 try {
                     $person->handleUpdate($p);
                     $person->save();
                     if (!empty($post['email'])) {
                         $email = new Email();
                         $email->setPerson($person);
                         $email->setEmail($post['email']);
                         $email->save();
                     }
                     if (!empty($post['phone']) || !empty($post['device_id'])) {
                         $phone = new Phone();
                         $phone->setPerson($person);
                         if (!empty($post['phone'])) {
                             $phone->setNumber($post['phone']);
                         }
                         if (!empty($post['device_id'])) {
                             $phone->setDeviceId($post['device_id']);
                         }
                         $phone->save();
                     }
                 } catch (\Exception $e) {
                     unset($person);
                 }
             }
         }
     }
     return isset($person) ? $person : null;
 }
开发者ID:CodeForEindhoven,项目名称:uReport,代码行数:61,代码来源:Open311Client.php

示例9: savePhones

 /** Saves phones into the database.
  * @param $data: an array of form formatted phones.
  * @param $pid, $link_type, $link_id: pid, link_type and link_id concerned by the update.
  */
 public static function savePhones(array $data, $pid, $link_type, $link_id = null)
 {
     foreach ($data as $id => $value) {
         $value['id'] = $id;
         if (!is_null($pid)) {
             $value['pid'] = $pid;
         }
         if (!is_null($link_type)) {
             $value['link_type'] = $link_type;
         }
         if (!is_null($link_id)) {
             $value['link_id'] = $link_id;
         }
         $phone = new Phone($value);
         $phone->save();
     }
 }
开发者ID:Ekleog,项目名称:platal,代码行数:21,代码来源:phone.php

示例10: addNewLead

 public function addNewLead($domain, $linkedin_contact_id)
 {
     $domain = DomainHelper::getDomain($domain);
     $company_domain = CompanyDomain::where("linkedin_contact_id", "=", $linkedin_contact_id)->get();
     for ($i = 0; $i < count($company_domain); $i++) {
         $company_domain[$i]->status = CompanyDomain::UNSELECTED;
         $company_domain[$i]->save();
     }
     $company_domain = CompanyDomain::where("linkedin_contact_id", "=", $linkedin_contact_id)->where("url", "=", $domain)->first();
     if (count($company_domain) == 0) {
         $linkedin_contact = LinkedinContact::find($linkedin_contact_id);
         $company_domain = new CompanyDomain();
         $company_domain->url = $domain;
         $company_domain->linkedin_url = "";
         $company_domain->status = CompanyDomain::SELECTED;
         $company_domain = $linkedin_contact->companyDomain()->save($company_domain);
         $company_domain->save();
         if ($linkedin_contact->started_at == '' || $linkedin_contact->started_at == '0000-00-00 00:00:00') {
             $linkedin_contact->started_at = date("Y-m-d H:i:s");
             $linkedin_contact->save();
         }
     } else {
         $company_domain = CompanyDomain::find($company_domain->id);
         $company_domain->status = CompanyDomain::SELECTED;
         $company_domain->save();
     }
     //SEO Scrapping Start
     $company_seo_data = $this->scrapeCompanySEO($domain);
     $company_domain->seo_company_title = $company_seo_data['seo_company_title'];
     $company_domain->seo_company_descriptoin = $company_seo_data['seo_company_descriptoin'];
     $company_domain->seo_company_keywords = $company_seo_data['seo_company_keywords'];
     //SEO Scrapping End
     //Company Social URL --Start
     $company_social_url = $this->companySocialURL($domain);
     $company_domain->company_facebook_url = $company_social_url['company_facebook_url'];
     $company_domain->company_twitter_url = $company_social_url['company_twitter_url'];
     $company_domain->company_google_url = $company_social_url['company_google_url'];
     $company_domain->fullcontact_company = $company_social_url['full_contact_company'];
     //Company Social URL --End
     // Company Visistat --Start
     $params = array('website' => $domain);
     //Query by Domain
     $objVisistat = new Visistat();
     $response_Visistat = $objVisistat->makeCall($params);
     $company_domain->visistat = $response_Visistat;
     // Company Visistat URL --End
     $company_domain->save();
     $linkedin_contact = LinkedinContact::find($linkedin_contact_id);
     $domain_list = $linkedin_contact->companyDomain()->get();
     $domain = array();
     $email_list = array();
     $valid_email_array_list = array();
     $api_email_array_list = array();
     $emails = array();
     $key = "id-";
     foreach ($domain_list as $domain_item) {
         $domain_id = $domain_item->id;
         $domain["id-" . $domain_item->id] = $domain_item->url;
         if ($domain_item->status == CompanyDomain::SELECTED) {
             $key = "id-" . $domain_item->id;
             $email_list = $this->emailGenerator($linkedin_contact->firstname, $linkedin_contact->lastname, $domain_item->url);
             $final_domain = $domain_item->url;
             $test_domain = explode("www.", $domain_item->url);
             if (count($test_domain) == 2) {
                 $final_domain = $test_domain[1];
             }
             $check_email = strtolower($linkedin_contact->firstname . "_" . $linkedin_contact->lastname . '@' . $final_domain);
             //echo $check_email; exit;
             //save paid email for a specific contact according to history patterns of that domain
             $paid_db_email_patterns_list = PaidDatabaseEmail::select('url', 'pattern_id', 'level', 'percentage', 'paid_db')->distinct()->where("url", "=", $domain_item->url)->get();
             if (count($paid_db_email_patterns_list) > 0) {
                 foreach ($paid_db_email_patterns_list as $patterns) {
                     $paid_email = "";
                     switch ($patterns['pattern_id']) {
                         case 1:
                             $patt = $linkedin_contact->firstname;
                             //first
                             $paid_email = strtolower($patt . '@' . $final_domain);
                             break;
                         case 2:
                             $patt = $linkedin_contact->firstname . "." . $linkedin_contact->lastname;
                             //first.last
                             $paid_email = strtolower($patt . '@' . $final_domain);
                             break;
                         case 3:
                             $patt = substr($linkedin_contact->firstname, 0, 1) . '' . $linkedin_contact->lastname;
                             //flast
                             $paid_email = strtolower($patt . '@' . $final_domain);
                             break;
                         case 4:
                             $patt = $linkedin_contact->lastname;
                             //last
                             $paid_email = strtolower($patt . '@' . $final_domain);
                             break;
                         case 5:
                             $patt = $linkedin_contact->firstname . "_" . $linkedin_contact->lastname;
                             //first_last
                             $paid_email = strtolower($patt . '@' . $final_domain);
                             break;
                         case 6:
//.........这里部分代码省略.........
开发者ID:jadoonz,项目名称:Code-Sample,代码行数:101,代码来源:SearchController(Laravel).php

示例11: PlFlagSet

 function handler_edit($page)
 {
     global $globals;
     $page->changeTpl('xnetgrp/edit.tpl');
     $error = false;
     if (S::admin()) {
         $domains = XDB::iterator('SELECT  *
                                     FROM  group_dom
                                 ORDER BY  nom');
         $page->assign('domains', $domains);
         $page->assign('super', true);
     }
     if (Post::has('submit')) {
         S::assert_xsrf_token();
         $flags = new PlFlagSet('wiki_desc');
         $flags->addFlag('notif_unsub', Post::i('notif_unsub') == 1);
         $site = Post::t('site');
         if ($site && $site != "http://") {
             $scheme = parse_url($site, PHP_URL_SCHEME);
             if (!$scheme) {
                 $site = "http://" . $site;
             }
         } else {
             $site = "";
         }
         $notify_all = Post::v('notify_all') ? true : false;
         if (!$notify_all) {
             $to_notify = array();
             $uf = new UserFilter(new UFC_Group($globals->asso('id'), true));
             $uids = $uf->getIds();
             foreach ($uids as $uid) {
                 if (Post::b('to_notify_' . $uid)) {
                     $to_notify[] = $uid;
                 }
             }
             if (count($to_notify) == 0) {
                 $notify_all = true;
                 $page->trigWarning("Aucun animateur n'ayant été selectionné pour recevoir les demandes d'inscriptions, tous le seront.");
             }
         }
         $flags->addFlag('notify_all', $notify_all);
         if (S::admin()) {
             $page->assign('super', true);
             if (Post::v('mail_domain') && strstr(Post::v('mail_domain'), '.') === false) {
                 $page->trigError('Le domaine doit être un FQDN (aucune modification effectuée)&nbsp;!!!');
                 $error = true;
             }
             if (Post::t('nom') == '' || Post::t('diminutif') == '') {
                 $page->trigError('Ni le nom ni le diminutif du groupe ne peuvent être vide.');
                 $error = true;
             }
             if ($error) {
                 $page->assign('nom', Post::t('nom'));
                 $page->assign('diminutif', Post::t('diminutif'));
                 $page->assign('mail_domain', Post::t('mail_domain'));
                 $page->assign('cat', Post::v('cat'));
                 $page->assign('dom', Post::v('dom'));
                 $page->assign('ax', Post::v('ax'));
                 $page->assign('axDate', Post::t('axDate'));
                 $page->assign('site', $site);
                 $page->assign('resp', Post::t('resp'));
                 $page->assign('mail', Post::t('mail'));
                 $page->assign('phone', Post::t('phone'));
                 $page->assign('fax', Post::t('fax'));
                 $page->assign('address', Post::t('address'));
                 $page->assign('forum', Post::t('forum'));
                 $page->assign('inscriptible', Post::v('inscriptible'));
                 $page->assign('sub_url', Post::t('sub_url'));
                 $page->assign('unsub_url', Post::t('unsub_url'));
                 $page->assign('welcome_msg', Post::t('welcome_msg'));
                 $page->assign('pub', Post::v('pub'));
                 $page->assign('notif_unsub', Post::i('notif_unsub'));
                 $page->assign('descr', Post::t('descr'));
                 $page->assign('disable_mails', Post::b('disable_mails'));
                 $page->assign('status', Post::v('status'));
                 $page->assign('error', $error);
                 return;
             }
             $axDate = make_datetime(Post::v('axDate'));
             if (Post::t('axDate') != '') {
                 $axDate = make_datetime(Post::v('axDate'))->format('Y-m-d');
             } else {
                 $axDate = null;
             }
             XDB::execute("UPDATE  groups\n                        SET  nom={?}, diminutif={?}, cat={?}, dom={?},\n                             descr={?}, site={?}, mail={?}, resp={?},\n                             forum={?}, mail_domain={?}, ax={?}, axDate = {?}, pub={?},\n                             sub_url={?}, inscriptible={?}, unsub_url={?},\n                             flags = {?}, welcome_msg = {?}, disable_mails = {?},\n                             status = {?}\n                      WHERE  id={?}", Post::v('nom'), Post::v('diminutif'), Post::v('cat'), Post::i('dom') == 0 ? null : Post::i('dom'), Post::v('descr'), $site, Post::v('mail'), Post::v('resp'), Post::v('forum'), Post::v('mail_domain'), Post::has('ax'), $axDate, Post::v('pub'), Post::v('sub_url'), Post::v('inscriptible'), Post::v('unsub_url'), $flags, Post::t('welcome_msg'), Post::b('disable_mails'), Post::v('status'), $globals->asso('id'));
             if (Post::v('mail_domain')) {
                 XDB::execute('INSERT IGNORE INTO  email_virtual_domains (name)
                                           VALUES  ({?})', Post::t('mail_domain'));
                 XDB::execute('UPDATE  email_virtual_domains
                                  SET  aliasing = id
                                WHERE  name = {?}', Post::t('mail_domain'));
             }
         } else {
             XDB::execute("UPDATE  groups\n                        SET  descr={?}, site={?}, mail={?}, resp={?},\n                             forum={?}, pub= {?}, sub_url={?},\n                             unsub_url = {?}, flags = {?}, welcome_msg = {?},\n                             status = {?}\n                      WHERE  id={?}", Post::v('descr'), $site, Post::v('mail'), Post::v('resp'), Post::v('forum'), Post::v('pub'), Post::v('sub_url'), Post::v('unsub_url'), $flags, Post::t('welcome_msg'), Post::v('status'), $globals->asso('id'));
         }
         Phone::deletePhones(0, Phone::LINK_GROUP, $globals->asso('id'));
         $phone = new Phone(array('link_type' => 'group', 'link_id' => $globals->asso('id'), 'id' => 0, 'type' => 'fixed', 'display' => Post::v('phone'), 'pub' => 'public'));
         $fax = new Phone(array('link_type' => 'group', 'link_id' => $globals->asso('id'), 'id' => 1, 'type' => 'fax', 'display' => Post::v('fax'), 'pub' => 'public'));
         $phone->save();
         $fax->save();
//.........这里部分代码省略.........
开发者ID:Ekleog,项目名称:platal,代码行数:101,代码来源:xnetgrp.php

示例12: commit

 public function commit()
 {
     $res = XDB::query('SELECT  id
                          FROM  profile_job_enum
                         WHERE  name = {?}', $this->name);
     if ($res->numRows() != 1) {
         XDB::execute('INSERT INTO  profile_job_enum (name, acronym, url, email, holdingid, SIREN_code, NAF_code, AX_code)
                            VALUES  ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})', $this->name, $this->acronym, $this->url, $this->email, $this->holdingid, $this->SIREN, $this->NAF_code, $this->AX_code);
         $jobid = XDB::insertId();
         $phone = new Phone(array('link_type' => 'hq', 'link_id' => $jobid, 'id' => 0, 'type' => 'fixed', 'display' => $this->tel, 'pub' => 'public'));
         $fax = new Phone(array('link_type' => 'hq', 'link_id' => $jobid, 'id' => 1, 'type' => 'fax', 'display' => $this->fax, 'pub' => 'public'));
         $address = new Address(array('jobid' => $jobid, 'type' => Address::LINK_COMPANY, 'text' => $this->address));
         $phone->save();
         $fax->save();
         $address->save();
     } else {
         $jobid = $res->fetchOneCell();
     }
     XDB::execute('UPDATE  profile_job
                      SET  jobid = {?}
                    WHERE  pid = {?} AND id = {?}', $jobid, $this->profile->id(), $this->id);
     if (XDB::affectedRows() == 0) {
         return XDB::execute('INSERT INTO  profile_job (jobid, pid, id)
                                   VALUES  ({?}, {?}, {?})', $jobid, $this->profile->id(), $this->id);
     }
     return true;
 }
开发者ID:Ekleog,项目名称:platal,代码行数:27,代码来源:entreprises.inc.php

示例13: function

    echo json_encode(objectToArray(json_decode($phones)));
});
// Get specific phone
$contactList->get("/phones/:id", function ($id) use($contactList) {
    $phones = Phone::find($id);
    $contactList->response()->header('Content-Type', 'application/json');
    echo json_encode(objectToArray(json_decode($phones)));
});
// Add new phone
$contactList->post("/phones", function () use($contactList) {
    $contactId = $contactList->request->params('contactid');
    $phone = $contactList->request->params('phone');
    $newPhone = new Phone();
    $newPhone->contactId = $contactId;
    $newPhone->phone = $phone;
    if ($newPhone->save()) {
        $data['msg'] = 'Phone saved successfully!';
        $data['id'] = $newPhone->id;
    } else {
        $data['msg'] = 'An error occurred while saving the phone!';
    }
    $contactList->response()->header('Content-Type', 'application/json');
    echo json_encode($data);
});
// Edit phone
$contactList->put("/phones/:id", function ($id) use($contactList) {
    $phone = $contactList->request->params('phone');
    $editPhone = Phone::find($id);
    $editPhone->phone = $phone;
    if ($editPhone->save()) {
        $data['msg'] = 'Phone saved successfully!';
开发者ID:vitorm11,项目名称:contactlist,代码行数:31,代码来源:index.php


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