本文整理汇总了PHP中Contact::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Contact::update方法的具体用法?PHP Contact::update怎么用?PHP Contact::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Contact
的用法示例。
在下文中一共展示了Contact::update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit_post
public function edit_post()
{
$data = $this->data;
//取得公用數據
//基本post欄位
$contactid_Num = $this->input->post('contactid_Num', TRUE);
$status_process_Num = $this->input->post('status_process_Num');
//建構Contact物件,並且更新
$Contact = new Contact(['contactid_Num' => $contactid_Num, 'status_process_Num' => $status_process_Num]);
$Contact->update(['db_update_Arr' => ['status_process']]);
//送出成功訊息
$this->load->model('Message');
$this->Message->show(['message' => '設定成功', 'url' => 'admin/base/contact/contact/tablelist']);
}
示例2: put
/**
* Update contact
*
* @param int $id Id of contact to update
* @param array $request_data Datas
* @return int
*
* @url PUT contact/{id}
*/
function put($id, $request_data = NULL)
{
if (!DolibarrApiAccess::$user->rights->societe->contact->creer) {
throw new RestException(401);
}
$result = $this->contact->fetch($id);
if (!$result) {
throw new RestException(404, 'Contact not found');
}
if (!DolibarrApi::_checkAccessToResource('contact', $this->contact->id, 'socpeople&societe')) {
throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
}
foreach ($request_data as $field => $value) {
$this->contact->{$field} = $value;
}
if ($this->contact->update($id, DolibarrApiAccess::$user, 1, '', '', 'update')) {
return $this->get($id);
}
return false;
}
示例3: testContactPut
public function testContactPut()
{
Client::relateIQ(GlobalVar::KEY, GlobalVar::SECRET);
$contact = new Contact(["id" => "551c7102e4b0e9a403dfb098"]);
$contact->name("Juan TorrezUpdated3");
$res = $contact->update();
$this->assertInstanceOf('Contact', $res);
$contact2 = new Contact(["id" => $res->id()]);
$this->assertEquals($contact->name(), $contact2->name());
$this->assertEquals("Juan TorrezUpdated3", $contact2->name());
}
示例4: sprintf
} else {
if (isset($_POST["restore"])) {
$contact->check($_POST["id"], DELETE);
if ($contact->restore($_POST)) {
Event::log($_POST["id"], "contacts", 4, "financial", sprintf(__('%s restores an item'), $_SESSION["glpiname"]));
}
$contact->redirectToList();
} else {
if (isset($_POST["purge"])) {
$contact->check($_POST["id"], PURGE);
if ($contact->delete($_POST, 1)) {
Event::log($_POST["id"], "contacts", 4, "financial", sprintf(__('%s purges an item'), $_SESSION["glpiname"]));
}
$contact->redirectToList();
} else {
if (isset($_POST["update"])) {
$contact->check($_POST["id"], UPDATE);
if ($contact->update($_POST)) {
Event::log($_POST["id"], "contacts", 4, "financial", sprintf(__('%s updates an item'), $_SESSION["glpiname"]));
}
Html::back();
} else {
Html::header(Contact::getTypeName(Session::getPluralNumber()), $_SERVER['PHP_SELF'], "management", "contact");
$contact->display(array('id' => $_GET["id"]));
Html::footer();
}
}
}
}
}
}
示例5: updatecontract
function updatecontract($_post)
{
$user->id = $this->getuser();
$profile = new Contact($user->id);
return $profile->update($_post);
}
示例6: update
/**
* Update parameters of third party
* @param id id societe
* @param user Utilisateur qui demande la mise a jour
* @param call_trigger 0=non, 1=oui
* @param allowmodcodeclient Inclut modif code client et code compta
* @param allowmodcodefournisseur Inclut modif code fournisseur et code compta fournisseur
* @return int <0 si ko, >=0 si ok
*/
function update($id, $user='', $call_trigger=1, $allowmodcodeclient=0, $allowmodcodefournisseur=0)
{
$result = parent::update($id, $user, $call_trigger, $allowmodcodeclient, $allowmodcodefournisseur);
return $result;
}
示例7: updateContact
/**
* Update a contact
*
* @param array $authentication Array of authentication information
* @param Contact $contact Contact
* @return array Array result
*/
function updateContact($authentication, $contact)
{
global $db, $conf, $langs;
$now = dol_now();
dol_syslog("Function: updateContact login=" . $authentication['login']);
if ($authentication['entity']) {
$conf->entity = $authentication['entity'];
}
// Init and check authentication
$objectresp = array();
$errorcode = '';
$errorlabel = '';
$error = 0;
$fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
// Check parameters
if (empty($contact['id'])) {
$error++;
$errorcode = 'KO';
$errorlabel = "Contact id is mandatory.";
}
if (!$error) {
$objectfound = false;
include_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
$object = new Contact($db);
$result = $object->fetch($contact['id']);
if (!empty($object->id)) {
$objectfound = true;
$object->firstname = $contact['firstname'];
$object->lastname = $contact['lastname'];
$object->address = $contact['address'];
$object->zip = $contact['zip'];
$object->town = $contact['town'];
$object->country_id = $contact['country_id'];
if ($contact['country_code']) {
$object->country_id = getCountry($contact['country_code'], 3);
}
$object->province_id = $contact['province_id'];
$object->phone_pro = $contact['phone_pro'];
$object->phone_perso = $contact['phone_perso'];
$object->phone_mobile = $contact['phone_mobile'];
$object->fax = $contact['fax'];
$object->email = $contact['email'];
$object->civility_id = $contact['civility_id'];
$object->poste = $contact['poste'];
$object->statut = $contact['statut'];
//Retreive all extrafield for contact
// fetch optionals attributes and labels
$extrafields = new ExtraFields($db);
$extralabels = $extrafields->fetch_name_optionals_label('socpeople', true);
foreach ($extrafields->attribute_label as $key => $label) {
$key = 'options_' . $key;
$object->array_options[$key] = $contact[$key];
}
$db->begin();
$result = $object->update($contact['id'], $fuser);
if ($result <= 0) {
$error++;
}
}
if (!$error && $objectfound) {
$db->commit();
$objectresp = array('result' => array('result_code' => 'OK', 'result_label' => ''), 'id' => $object->id);
} elseif ($objectfound) {
$db->rollback();
$error++;
$errorcode = 'KO';
$errorlabel = $object->error;
} else {
$error++;
$errorcode = 'NOT_FOUND';
$errorlabel = 'Contact id=' . $contact['id'] . ' cannot be found';
}
}
if ($error) {
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
return $objectresp;
}
示例8: trim
<?php
/** Ofuz Open Source version is released under the GNU Affero General Public License, please read the full license at: http://www.gnu.org/licenses/agpl-3.0.html **/
// Copyright 2008 - 2010 all rights reserved, SQLFusion LLC, info@sqlfusion.com
/** Ofuz Open Source version is released under the GNU Affero General Public License, please read the full license at: http://www.gnu.org/licenses/agpl-3.0.html **/
/**
* unsubscribe a user
*/
include_once "config.php";
$idcontact = (int) $_GET['idc'];
$iduser = (int) trim($_GET['idu']);
$do_contact = new Contact();
//$do_contact->getId($idcontact);
$do_user = new User();
$do_user->getId($iduser);
$do_user->sessionPersistent('user_unsub', 'unsubscribe_message.php', TTL_OFUZ);
$do_contact->query("SELECT * \n FROM contact \n WHERE contact.idcontact=" . $idcontact . " AND contact.iduser = " . $iduser);
if ($do_contact->getNumRows() == 0) {
$do_contact->query("SELECT contact.*\n FROM contact, contact_sharing \n WHERE `contact_sharing`.`idcoworker` = " . $iduser . "\n AND contact.idcontact = contact_sharing.idcontact\n\t\t\t\t\t\t\tAND contact.idcontact=" . $idcontact);
}
if ($do_contact->getNumRows() == 1 && $do_user->getNumRows() == 1) {
$do_contact->email_optout = 'y';
$do_contact->update();
$do_workfeed_uns = new WorkFeedContactUnsubscibeEmails();
$do_workfeed_uns->addUnsubscribeEmailWorkfeed($do_contact);
}
//$do_contact->sessionPersistent('do_contact', 'unsubscribe_messaage.php', OFUZ_TTL);
header("Location: /unsubscribe_message.php");
exit;
示例9: switch
//.........这里部分代码省略.........
if (!empty($ligne[2])) {
$doliprod->status = $ligne[2];
}
$doliprod->status_buy = 1;
if (!empty($ligne[3])) {
$doliprod->description = $ligne[3];
}
if (!empty($ligne[4])) {
$doliprod->price = $ligne[4];
}
if (!empty($ligne[5])) {
$doliprod->tva_tx = $ligne[5];
}
if (!empty($ligne[6])) {
$doliprod->weight = $ligne[6];
}
if (!empty($ligne[7])) {
$doliprod->volume = $ligne[7];
}
if (!empty($ligne[9])) {
$doliprod->barcode = $ligne[9];
}
if (!empty($ligne[9])) {
$doliprod->barcode_type = dol_getIdFromCode($this->db, $ligne[10], 'c_barcode_type', 'libelle', 'rowid');
}
if (!empty($ligne[10])) {
$doliprod->type = $ligne[11];
}
$doliprod->price_base_type = 'HT';
$this->db->begin;
switch ($typeimport) {
case 'C':
if ($pid > 0) {
if ($doliprod->update($pid, $this->user) < 0) {
$this->process_msg .= $langs->trans("ErrProductUpdate", $ligne[0], $doliprod->error) . "\n";
$error++;
}
if ($doliprod->updatePrice($doliprod->price, $doliprod->price_base_type, $this->user) < 0) {
$this->process_msg .= $langs->trans("ErrProductUpdate", $ligne[0], $doliprod->error) . "\n";
$error++;
}
} else {
if ($doliprod->create($this->user) < 0) {
$this->process_msg .= $langs->trans("ErrProductCreate", $ligne[0], $doliprod->error) . "\n";
$error++;
} else {
// image et code barre
if ($ligne[8]) {
$this->add_photo_web($conf->produit->dir_output, $ligne[8], $doliprod->id);
}
/*if ($ligne[9]) {
if ($doliprod->setValueFrom('fk_barcode_type', 2) < 0){
$this->process_msg .= $langs->trans("ErrProductCreate", $ligne[0], $doliprod->error)."\n"; // TODO paramétrer
$error++;
}
if ($doliprod->setValueFrom('barcode', $ligne[9]) < 0 ){
$this->process_msg .= $langs->trans("ErrProductCreate", $ligne[0], $doliprod->error)."\n";
$error++;
}
}*/
}
}
break;
/*case 'M':
if ($pid>0)
{
示例10: testContactUpdate
/**
* testContactUpdate
*
* @param Contact $localobject Contact
* @return int
*
* @depends testContactFetch
* The depends says test is run only if previous is ok
*/
public function testContactUpdate($localobject)
{
global $conf, $user, $langs, $db;
$conf = $this->savconf;
$user = $this->savuser;
$langs = $this->savlangs;
$db = $this->savdb;
$localobject->oldcopy = clone $localobject;
$localobject->note_private = 'New private note after update';
$localobject->note_public = 'New public note after update';
$localobject->lastname = 'New name';
$localobject->firstname = 'New firstname';
$localobject->address = 'New address';
$localobject->zip = 'New zip';
$localobject->town = 'New town';
$localobject->country_id = 2;
//$localobject->status=0;
$localobject->phone_pro = 'New tel pro';
$localobject->phone_perso = 'New tel perso';
$localobject->phone_mobile = 'New tel mobile';
$localobject->fax = 'New fax';
$localobject->email = 'newemail@newemail.com';
$localobject->jabberid = 'New im id';
$localobject->default_lang = 'es_ES';
$result = $localobject->update($localobject->id, $user);
print __METHOD__ . " id=" . $localobject->id . " result=" . $result . "\n";
$this->assertLessThan($result, 0, 'Contact::update error');
$result = $localobject->update_note($localobject->note_private, '_private');
print __METHOD__ . " id=" . $localobject->id . " result=" . $result . "\n";
$this->assertLessThan($result, 0, 'Contact::update_note (private) error');
$result = $localobject->update_note($localobject->note_public, '_public');
print __METHOD__ . " id=" . $localobject->id . " result=" . $result . "\n";
$this->assertLessThan($result, 0, 'Contact::update_note (public) error');
$newobject = new Contact($this->savdb);
$result = $newobject->fetch($localobject->id);
print __METHOD__ . " id=" . $localobject->id . " result=" . $result . "\n";
$this->assertLessThan($result, 0, 'Contact::fetch error');
print __METHOD__ . " old=" . $localobject->note_private . " new=" . $newobject->note_private . "\n";
$this->assertEquals($localobject->note_private, $newobject->note_private);
//print __METHOD__." old=".$localobject->note_public." new=".$newobject->note_public."\n";
//$this->assertEquals($localobject->note_public, $newobject->note_public);
print __METHOD__ . " old=" . $localobject->lastname . " new=" . $newobject->lastname . "\n";
$this->assertEquals($localobject->lastname, $newobject->lastname);
print __METHOD__ . " old=" . $localobject->firstname . " new=" . $newobject->firstname . "\n";
$this->assertEquals($localobject->firstname, $newobject->firstname);
print __METHOD__ . " old=" . $localobject->address . " new=" . $newobject->address . "\n";
$this->assertEquals($localobject->address, $newobject->address);
print __METHOD__ . " old=" . $localobject->zip . " new=" . $newobject->zip . "\n";
$this->assertEquals($localobject->zip, $newobject->zip);
print __METHOD__ . " old=" . $localobject->town . " new=" . $newobject->town . "\n";
$this->assertEquals($localobject->town, $newobject->town);
print __METHOD__ . " old=" . $localobject->country_id . " new=" . $newobject->country_id . "\n";
$this->assertEquals($localobject->country_id, $newobject->country_id);
print __METHOD__ . " old=BE new=" . $newobject->country_code . "\n";
$this->assertEquals('BE', $newobject->country_code);
//print __METHOD__." old=".$localobject->status." new=".$newobject->status."\n";
//$this->assertEquals($localobject->status, $newobject->status);
print __METHOD__ . " old=" . $localobject->phone_pro . " new=" . $newobject->phone_pro . "\n";
$this->assertEquals($localobject->phone_pro, $newobject->phone_pro);
print __METHOD__ . " old=" . $localobject->phone_pro . " new=" . $newobject->phone_pro . "\n";
$this->assertEquals($localobject->phone_perso, $newobject->phone_perso);
print __METHOD__ . " old=" . $localobject->phone_mobile . " new=" . $newobject->phone_mobile . "\n";
$this->assertEquals($localobject->phone_mobile, $newobject->phone_mobile);
print __METHOD__ . " old=" . $localobject->fax . " new=" . $newobject->fax . "\n";
$this->assertEquals($localobject->fax, $newobject->fax);
print __METHOD__ . " old=" . $localobject->email . " new=" . $newobject->email . "\n";
$this->assertEquals($localobject->email, $newobject->email);
print __METHOD__ . " old=" . $localobject->jabberid . " new=" . $newobject->jabberid . "\n";
$this->assertEquals($localobject->jabberid, $newobject->jabberid);
print __METHOD__ . " old=" . $localobject->default_lang . " new=" . $newobject->default_lang . "\n";
$this->assertEquals($localobject->default_lang, $newobject->default_lang);
return $localobject;
}
示例11: posteventAddContact
/**
* saveWebForm()
* this will check if contact exists with firname, lastname, name and email
* If exist add to it, if doesn't exists create a new one.
*/
function posteventAddContact($fid, $fields, $nxturl, $uid, $tags)
{
//echo 'hh';die();
//$fields = $_REQUEST['fields'];
//$fields = $event_controler->fields;
$this->setLog("\n eventAddContact, creating new contact from form, using " . count($fields) . " fields. (" . date("Y/m/d H:i:s") . ")");
//$dropcode = $_POST['dropcode'];
$do_contact = new Contact();
$do_contact->iduser = $uid;
$do_contact->add();
$this->setLog("\n new contact:" . $do_contact->idcontact . " for user:" . $uid);
foreach ($fields as $field_name => $field_value) {
$this->setLog("\n Processing field:" . $field_name . " with value:" . $field_value);
$do_webform_fields = new WebFormUserField();
$do_webform_fields->query("SELECT wfu.name, wff.class as class_name, wff.variable, wff.variable_type, wfu.required \n\t\t FROM webformfields as wff, webformuserfield as wfu \n\t\t\t\t\t\t\t\t\t\t WHERE wff.name=wfu.name\n\t\t\t\t\t\t\t\t\t\t AND wfu.name = '" . $field_name . "'\n\t\t\t\t\t\t\t\t\t\t\t AND wfu.idwebformuser= " . $fid);
$this->setLog("\n Field information class:" . $do_webform_fields->class_name . " Variable:" . $do_webform_fields->variable);
$this->setLog("\n rows:" . $do_webform_fields->getNumRows());
if ($do_webform_fields->getNumRows() == 1) {
if ($do_webform_fields->class_name == "Contact") {
$this->setLog("\n Updating contact");
$do_contact->{$do_webform_fields->variable} = $field_value;
$do_contact->update();
} else {
$update = false;
if (is_object(${'sub_' . $do_webform_fields->class_name})) {
if (${'sub_' . $do_webform_fields->class_name}->getType() == $do_webform_fields->variable_type) {
$update = true;
}
}
if ($update) {
$this->setLog("\n Updating class:" . $do_webform_fields->class_name);
$obj = ${'sub_' . $do_webform_fields->class_name};
$obj->{$do_webform_fields->variable} = $field_value;
$obj->update();
} else {
$class_name = $do_webform_fields->class_name;
${'sub_' . $class_name} = new $class_name();
$obj = ${'sub_' . $class_name};
$obj->{$do_webform_fields->variable} = $field_value;
if (method_exists($obj, "setType") && strlen($do_webform_fields->variable_type) > 0) {
$obj->setType($do_webform_fields->variable_type);
}
$obj->idcontact = $do_contact->getPrimaryKeyValue();
$obj->add();
}
}
}
}
$contact_view = new ContactView();
$contact_view->setUser($uid);
$contact_view->addFromContact($do_contact);
$tags = explode(",", $tags);
foreach ($tags as $tag) {
$tag = trim($tag);
$do_tag = new Tag();
$do_tag->addNew();
$do_tag->addTagAssociation($do_contact->getPrimaryKeyValue(), $tag, "contact", $fid);
$contact_view->addTag($tag);
}
if (strlen($nexturl) > 0) {
//$event_controler->setUrlNext($this->urlnext);
header("location:{$nxturl}");
} else {
//$event_controler->setUrlNext($GLOBALS['cfg_ofuz_site_http_base'].'web_form_thankyou.php');
$url = $GLOBALS['cfg_ofuz_site_http_base'] . 'web_form_thankyou.php';
header("location:{$url}");
}
//$event_controler->addParam("do_contact", $do_contact);
}
示例12: updateContactEntry
/**
* Updates a contact entry in ofuz Database.
* @param array,int,int : contact details, contact id, company id
* @return void
* @see class : Company, Contact
*/
function updateContactEntry($entry, $id_contact, $id_company = null)
{
if (!$id_company) {
$new_company = new Company();
$new_company->name = $entry['org_name'];
$new_company->iduser = $this->id_user;
$new_company->add();
$id_company = $new_company->getPrimaryKeyValue();
}
$contact = new Contact();
$contact->getId($id_contact);
// Primarykey id of the record to update
$contact->company = $entry['org_name'];
//do not update name while importing since Gmail has only one text box for the name
//$contact->firstname = $entry['title'];
$contact->idcompany = $id_company;
//$contact->iduser = $this->id_user;
$contact->position = $entry['org_title'];
$contact->update();
$q_contact = new sqlQuery($this->getDbCon());
$sql_sel = "SELECT * FROM contact_address WHERE idcontact = " . $id_contact;
$q_contact->query($sql_sel);
if ($q_contact->getNumRows()) {
while ($q_contact->fetch()) {
if ($q_contact->getData("address_type") == "Home") {
$contact->updateAddress($entry['address_home'], 'Home', $q_contact->getData("idcontact_address"));
}
if ($q_contact->getData("address_type") == "Other") {
$contact->updateAddress($entry['address_other'], 'Other', $q_contact->getData("idcontact_address"));
}
if ($q_contact->getData("address_type") == "Work") {
$contact->updateAddress($entry['address_work'], 'Work', $q_contact->getData("idcontact_address"));
}
}
}
$sql_sel = "SELECT * FROM contact_email WHERE idcontact = " . $id_contact;
$q_contact->query($sql_sel);
if ($q_contact->getNumRows()) {
while ($q_contact->fetch()) {
if ($q_contact->getData("email_type") == "Home") {
$contact->updateEmail($entry['em_home'], 'Home', $q_contact->getData("idcontact_email"));
}
if ($q_contact->getData("email_type") == "Other") {
$contact->updateEmail($entry['em_other'], 'Other', $q_contact->getData("idcontact_email"));
}
if ($q_contact->getData("email_type") == "Work") {
$contact->updateEmail($entry['em_work'], 'Work', $q_contact->getData("idcontact_email"));
}
}
}
$sql_sel = "SELECT * FROM contact_phone WHERE idcontact = " . $id_contact;
$q_contact->query($sql_sel);
if ($q_contact->getNumRows()) {
while ($q_contact->fetch()) {
if ($q_contact->getData("phone_type") == "Home") {
$contact->updatePhone($entry['ph_home'], 'Home', $q_contact->getData("idcontact_phone"));
}
if ($q_contact->getData("phone_type") == "Mobile") {
$contact->updatePhone($entry['ph_mobile'], 'Mobile', $q_contact->getData("idcontact_phone"));
}
if ($q_contact->getData("phone_type") == "Work") {
$contact->updatePhone($entry['ph_work'], 'Work', $q_contact->getData("idcontact_phone"));
}
}
}
}
示例13: updateContact
public function updateContact($mysql, $cid, $name, $email, $phone, $ownerid) {
$con = new Contact();
switch($con->select($cid, $ownerid, $mysql)) {
case Contact::DATABASE_ERROR :
{
echo "<p>A Database error has occured.</p>";
return;
}
case Contact::INVALID_DATA :
{
echo "<p>Invalid operation requested.</p>";
return;
}
case Contact::SELECT_SUCCESS :
default :
break;
}
$con->read($ownerid, $name, $email, $phone);
switch($con->update($mysql)) {
case Contact::DATABASE_ERROR :
{
echo "<p>A Database error has occured.</p>";
return;
}
case Contact::INVALID_DATA :
{
echo "<p>Invalid operation requested.</p>";
return;
}
case Contact::UPDATE_SUCCESS :
{
echo "<p>Contact updated successfully.</p>";
break;
}
default :
break;
}
}
示例14: Contact
<?php
if (Tools::P('content')) {
$contact = new Contact();
$contact->copyFromPost();
if ($contact->add()) {
$c = new Contact(Tools::getRequest('id_parent'));
$c->active = 1;
$c->update();
$vars = array('{name}' => $cookie->name, '{subject}' => $contact->subject, '{message}' => $contact->content);
Mail::Send('replay', $c->subject, $vars, $c->email);
if ($c->id_user > 0) {
Alert::Send($c->id_user, $contact->content);
}
}
if (is_array($contact->_errors) and count($contact->_errors) > 0) {
$errors = $contact->_errors;
} else {
echo '<div class="conf">回复成功</div>';
}
}
if (isset($_GET['id'])) {
$id = (int) $_GET['id'];
$obj = new Contact($id);
$subs = $obj->getSubMessage();
if ($obj->id_user > 0) {
$userAllContact = $obj->getContactByUser();
}
}
if (isset($errors)) {
UIAdminAlerts::MError($errors);
示例15: Validation
?>
">Cancel</a>
</span>
</div>
</div>
<?php
//Validates data
if (Input::exists()) {
$validate = new Validation();
$validation = $validate->check($_POST, array('band' => array('max' => 64), 'first_name' => array('max' => 64), 'last_name' => array('max' => 64), 'email' => array('required' => true, 'max' => 1024, 'is_email' => true), 'phone' => array('max' => 64, 'is_numeric' => true), 'mobile' => array('max' => 64, 'is_numeric' => true), 'company' => array('max' => 64), 'add_line_1' => array('max' => 128), 'add_line_2' => array('max' => 128), 'state' => array('max' => 128), 'city' => array('max' => 128), 'post_code' => array('max' => 128, 'is_numeric' => true)));
if ($validation->passed()) {
$contact = new Contact();
try {
//sends updated data to the database
$contact->update(Input::get('id'), array('company' => Input::get('company'), 'band' => Input::get('band'), 'first_name' => Input::get('first_name'), 'last_name' => Input::get('last_name'), 'email' => Input::get('email'), 'add_line_1' => Input::get('add_line_1'), 'add_line_2' => Input::get('add_line_2'), 'state' => Input::get('state'), 'city' => Input::get('city'), 'post_code' => Input::get('post_code'), 'phone' => Input::get('phone'), 'mobile' => Input::get('mobile'), 'notes' => Input::get('notes'), 'date_modified' => date('Y-m-d H:i:s')));
Session::flash('home', 'The <a href="contact.php?id=' . Input::get('id') . '">contact</a> has been updated successfully');
Redirect::to('index.php');
} catch (Exception $e) {
Session::flash('home', $e->getMessage());
Redirect::to('index.php');
exit;
}
} else {
echo '<ul class="error">';
foreach ($validation->errors() as $error) {
echo '<li>' . $error . '</li>';
}
echo '</ul>';
}
}