public function indexAction() { $umsg = Contact::find(array("co_status = 0")); $this->view->umsg = $umsg; $rmsg = Contact::find(array("co_status = 1")); $this->view->rmsg = $rmsg; }
public function getContact($id) { $contact = Contact::find($id); if (!$contact) { return Redirect::to('admin/contact'); } $this->layout->body = View::make('admin.contact')->with('contact', $contact); }
public function testRemove() { $first = Contact::first(); $id = $first->id; $crawler = $this->client->request('DELETE', '/api/contact/' . $id); $this->assertTrue($this->client->getResponse()->isOk()); $first = Contact::find($id); $this->assertTrue($first == null); }
protected function saveModel($contact = false) { if (Input::get('id')) { $contact = Contact::find(Input::get('id')); } if (!$contact) { $contact = new Contact(); } $contact->function = Input::get('function'); $contact->first_name = Input::get('first_name'); $contact->last_name = Input::get('last_name'); $contact->references = Input::get('references'); $contact->notes = Input::get('notes'); $address = $contact->address()->first() ?: new Address(); $address_input = Input::get('address'); $country = Country::where('name', Input::get('country'))->first(); if ($country) { $address->country()->associate($country); } $address->address = isset($address_input['address']) ? $address_input['address'] : ''; $address->postal_code = isset($address_input['postal_code']) ? $address_input['postal_code'] : ''; $address->city = isset($address_input['city']) ? $address_input['city'] : ''; $address->state_province = isset($address_input['state_province']) ? $address_input['state_province'] : ''; $address->phone = isset($address_input['phone']) ? $address_input['phone'] : ''; $address->fax = isset($address_input['fax']) ? $address_input['fax'] : ''; $address->email = isset($address_input['email']) ? $address_input['email'] : ''; $address->website = isset($address_input['website']) ? $address_input['website'] : ''; $address->save(); $contact->address()->associate($address); $contact->save(); $parentQuery = Input::get('parent_model'); if (!empty($parentQuery)) { $parentModel = null; switch ($parentQuery) { case 'events': $relation = 'events'; $parentModel = 'Events'; break; case 'company': $relation = 'companies'; $parentModel = 'Company'; break; case 'venue': $relation = 'venues'; $parentModel = 'Venue'; break; default: break; } if (!empty($parentModel)) { $contact->{$relation}()->detach($parentModel::find(Input::get('parent_id'))); $contact->{$relation}()->attach($parentModel::find(Input::get('parent_id'))); } } return $contact; }
private function _conditions($offset, $is_visibled) { $columns = array(array('key' => 'name', 'title' => '稱呼', 'sql' => 'name LIKE ?'), array('key' => 'email', 'title' => 'E-Mail', 'sql' => 'email LIKE ?'), array('key' => 'message', 'title' => '留言', 'sql' => 'message LIKE ?'), array('key' => 'ip', 'title' => 'IP', 'sql' => 'ip LIKE ?')); $configs = array('admin', $this->get_class(), '%s'); $conditions = conditions($columns, $configs); Contact::addConditions($conditions, 'is_visibled = ?', $is_visibled); $limit = 25; $total = Contact::count(array('conditions' => $conditions)); $offset = $offset < $total ? $offset : 0; $this->load->library('pagination'); $pagination = $this->pagination->initialize(array_merge(array('total_rows' => $total, 'num_links' => 5, 'per_page' => $limit, 'uri_segment' => 0, 'base_url' => '', 'page_query_string' => false, 'first_link' => '第一頁', 'last_link' => '最後頁', 'prev_link' => '上一頁', 'next_link' => '下一頁', 'full_tag_open' => '<ul class="pagination">', 'full_tag_close' => '</ul>', 'first_tag_open' => '<li>', 'first_tag_close' => '</li>', 'prev_tag_open' => '<li>', 'prev_tag_close' => '</li>', 'num_tag_open' => '<li>', 'num_tag_close' => '</li>', 'cur_tag_open' => '<li class="active"><a href="#">', 'cur_tag_close' => '</a></li>', 'next_tag_open' => '<li>', 'next_tag_close' => '</li>', 'last_tag_open' => '<li>', 'last_tag_close' => '</li>'), $configs))->create_links(); $contacts = Contact::find('all', array('offset' => $offset, 'limit' => $limit, 'conditions' => $conditions)); return array('contacts' => $contacts, 'pagination' => $pagination, 'columns' => $columns); }
public function update($id) { $input = Input::all(); $validator = Validator::make($input, Contact::$rules); if ($validator->fails()) { return Response::json(["status" => "FAIL", "errors" => $validator->messages()]); } // Validation passed $obj = Contact::find($id); $obj->name = $input['name']; $obj->email = $input['email']; $obj->phone = $input['phone']; $obj->save(); return Response::json(["status" => "OK"]); }
/** * Controller for all buddy related action. * * The following actions are supported: * - "add" to add a user to the current user's buddy list * - "remove" to remove a user from the current user's buddy list * * @param String $action The action to be executed */ public function buddy_action($action = 'add') { $username = Request::username('username'); if ($action === 'add' && $username !== null) { if (Contact::import(array('owner_id' => User::findCurrent()->id, 'user_id' => User::findByUsername($username)->id))->store()) { PageLayout::postMessage(MessageBox::success(_('Der Benutzer wurde zu Ihren Kontakten hinzugefügt.'))); } } elseif ($action === 'remove' && $username !== null) { $contact = Contact::find(array(User::findCurrent()->id, User::findByUsername($username)->id)); if ($contact && $contact->delete()) { PageLayout::postMessage(MessageBox::success(_('Der Benutzer gehört nicht mehr zu Ihren Kontakten.'))); } } $this->redirect('online'); }
/** * @depends testRelations */ public function testDelete($contact) { $cid = $contact->id; $uid = $contact->user_id; $new_contact = new Contact(); $new_user = new User(); $this->assertEquals($cid, $new_contact->find($cid)->id); $this->assertEquals($uid, $new_user->eq('id', $uid)->find()->id); $this->assertTrue($contact->user->delete()); $this->assertTrue($contact->delete()); $new_contact = new Contact(); $new_user = new User(); $this->assertFalse($new_contact->eq('id', $cid)->find()); $this->assertFalse($new_user->find($uid)); }
public function executeEmails() { $pools = $this->getTargetEmails(); if (!$pools) { return; } foreach ($pools as $pool) { $trysending = true; $contact = Contact::find($pool->contact_id); if ($contact->templateExist($pool->template_id)) { $templateid = $contact->getAvalaibleTemplate(); if ($templateid == 0) { //if template for send not exist disactivated contact $trysending = false; $contact->saveHistory("all have been sent", $pool->member_id, $pool->template_id); $contact->active = 0; $contact->save(); } else { //try to send another template $contact->saveHistory("sendanother", $pool->member_id, $pool->template_id); $pool->template_id = $templateid; $pool->save(); } } if ($trysending) { if (EmailSchedullerPool::sendmail($pool->member_id, $pool->contact_id, $pool->template_id)) { if ($contact->email_sent == "" || $contact->email_sent == 0) { $contact->email_sent = $pool->template_id; } else { $contact->email_sent = $contact->email_sent . "," . $pool->template_id; } $contact->save(); $contact->saveHistory("success", $pool->member_id, $pool->template_id); $newtemplate = $contact->getAvalaibleTemplate(); if ($newtemplate) { $contact->insertPoolingSchedule($contact->id, $contact->user_id, $newtemplate); } else { $contact->saveHistory("all have been sent", $pool->member_id, $pool->template_id); $contact->active = 0; $contact->save(); } $pool->delete(); } else { //ARBUD : retry sending email 3 times } } } }
public function postEdit($id = null) { $validator = Validator::make(Input::all(), Contact::$rulesEdit); $data = Input::all(); $contact = Contact::find($id); if (is_null($contact)) { App::abort(404); } if ($validator->passes()) { $contact->fill($data); $contact->birthdate = date("Y-m-d", strtotime(Input::get('birthdate'))); $contact->save(); return Redirect::to(Input::get('url') . '#' . $contact->id)->with('confirmation', '¡Los datos de ' . $contact->fullname() . ' fueron actualizados!'); } else { // validation has failed, display error messages return Redirect::to(Input::get('url') . '#edit' . $contact->id)->with('message', 'Debes corregir los siguientes campos:')->withErrors($validator)->withInput(); } }
protected function saveModel($venue = false) { if (Input::get('id')) { $venue = Venue::find(Input::get('id')); } if (!$venue) { $venue = new Venue(); } $venue->name = Input::get('name'); $venue->indoor_or_outdoor = Input::get('indoor_or_outdoor'); $venue->name_of_hall = Input::get('name_of_hall'); $venue->capacity = Input::get('capacity'); $venue->dimension_height = Input::get('dimension_height'); $venue->dimension_width = Input::get('dimension_width'); $venue->dimension_length = Input::get('dimension_length'); $venue->rigging_capacity = Input::get('rigging_capacity'); $venue->notes = Input::get('notes'); $address = $venue->address()->first() ?: new Address(); $country = Country::where('name', Input::get('country'))->first(); $address->country()->associate($country); $address->address = Input::get('address_address'); $address->postal_code = Input::get('address_postal_code'); $address->city = Input::get('address_city'); $address->state_province = Input::get('address_state_province'); $address->phone = Input::get('address_phone'); $address->fax = Input::get('address_fax'); $address->email = Input::get('address_email'); $address->website = Input::get('address_website'); $address->save(); $venue->address()->associate($address); $venue->save(); $venue->save(); if (Input::get('company_id')) { $venue->companies()->detach(Company::find(Input::get('company_id'))); $venue->companies()->attach(Company::find(Input::get('company_id'))); } if (Input::get('contact_id')) { $venue->contacts()->detach(Contact::find(Input::get('contact_id'))); $venue->contacts()->attach(Contact::find(Input::get('contact_id'))); } return $venue; }
protected function saveModel($company = false) { if (Input::get('id')) { $company = Company::find(Input::get('id')); } if (!$company) { $company = new Company(); } $company->name = Input::get('name'); $company->type = Input::get('type'); $company->references = Input::get('references'); $company->bank_details = Input::get('bank_details'); $company->tax_number = Input::get('tax_number'); $company->notes = Input::get('notes'); $address = $company->address()->first() ?: new Address(); $country = Country::where('id', Input::get('country'))->first(); $address->country()->associate($country); $address->address = Input::get('address_address'); $address->postal_code = Input::get('address_postal_code'); $address->city = Input::get('address_city'); $address->state_province = Input::get('address_state_province'); $address->phone = Input::get('address_phone'); $address->fax = Input::get('address_fax'); $address->email = Input::get('address_email'); $address->website = Input::get('address_website'); $address->save(); $company->address()->associate($address); $company->save(); if (Input::get('venue_id')) { $company->venues()->detach(Venue::find(Input::get('venue_id'))); $company->venues()->attach(Venue::find(Input::get('venue_id'))); } if (Input::get('contact_id')) { $company->contacts()->detach(Contact::find(Input::get('contact_id'))); $company->contacts()->attach(Contact::find(Input::get('contact_id'))); } if (Input::get('event_id')) { $company->events()->detach(Events::find(Input::get('event_id'))); $company->events()->attach(Events::find(Input::get('event_id'))); } return $company; }
public function indexAction() { $auth = $this->session->get('auth'); $this->view->name = $auth[name]; $date = date('Y-m-d'); echo $date; $orders = Orders::find("o_delivery = 0"); $nosorders = count($orders); $contact = Contact::find("co_status = 0"); $noscontact = count($contact); $users = Userdetails::find(); $nosusers = count($users); $result = Orders::sum(array('column' => 'o_price', "conditions" => "o_date = :date:", "bind" => array("date" => $date))); /*$phql="SELECT SUM(o_price) AS costs FROM Orders where o_date='2015-12-11'"; $result = $this->modelsManager->executeQuery($phql);*/ $this->view->nosorders = $nosorders; $this->view->noscontact = $noscontact; $this->view->nosusers = $nosusers; $this->view->nossale = $result; }
public function sendEmailpost() { $rules = ['contact_id' => 'required', 'template_id' => 'required']; $validator = Validator::make(Input::all(), $rules); // if the validator fails, redirect back to the form if ($validator->fails()) { return Redirect::back()->withErrors($validator); } else { $contact = Contact::find(Input::get('contact_id')); if (!$contact->active) { return Redirect::back()->with('message', 'Kontak tidak aktif'); } $memberid = Auth::user()->id; $contactid = Input::get('contact_id'); $templateid = Input::get('template_id'); $issent = EmailSchedullerPool::sendManualEmail($memberid, $contactid, $templateid); if ($issent) { return Redirect::to(Auth::user()->roleString() . '/outbox')->with('message', 'Email berhasil dikirim.'); } return Redirect::back()->with('message', 'Email tidak dapat dikirim, mohon mencoba kembali.'); } }
public function d($id) { if (Input::get('remarks_hid') == "" || Input::get('remarks_hid') == "Write remarks here.") { return Redirect::route('contact.dt', $id)->withInput()->with('class', 'error')->with('message', 'Write a *remarks first.'); } $contact = Contact::find($id); $gettime = time() - 14400; $datetime_now = date("H:i:s", $gettime); if (is_null($contact)) { $class = 'error'; $message = 'Record does not exist.'; } else { $contact->remarks = strtoupper(Input::get('remarks_hid')); $contact->status = 3; $contact->notif = 1; $contact->notif_dt = date('Y-m-d') . ' ' . $datetime_now; $contact->approved_by = Auth::id(); $contact->save(); $contact_person = DB::table('contacts')->select('id', 'fullname', 'created_by')->where('id', $id)->first(); DB::table('contact_status')->where('contact_id', $id)->where('access', 1)->update(array('access' => 2)); DB::table('contact_status')->insert(array(['contact_id' => $contact_person->id, 'user_id' => Auth::id(), 'update' => 'DENIED THE REQUEST FOR' . ' ' . $contact_person->fullname, 'created_by' => $contact_person->created_by, 'created_at' => date('Y-m-d') . ' ' . $datetime_now, 'access' => 3])); $class = 'success'; $message = 'Record successfully Denied.'; } return Redirect::route('contact.ra')->with('class', $class)->with('message', $message); }
public function fieldData($id) { $contact = Contact::find($id); return Response::json(['first_name' => $contact->first_name, 'last_name' => $contact->last_name, 'email' => $contact->email, 'phone' => $contact->phone, 'ac_id' => $contact->ac_id, 'custom_field_1' => $contact->custom_field_1, 'custom_field_2' => $contact->custom_field_2, 'custom_field_3' => $contact->custom_field_3, 'custom_field_4' => $contact->custom_field_4, 'custom_field_5' => $contact->custom_field_5]); }
public static function decryptContact($contactString) { try { $decrypted_secret = Crypt::decrypt($contactString); //decrypted $contact = Contact::find($decrypted_secret); } catch (Exception $e) { return null; } return $contact; }
function remove_action($group = null) { $contact = Contact::find(array(User::findCurrent()->id, User::findByUsername(Request::username('user'))->id)); if ($contact) { if ($group) { $contact->group_assignments->unsetBy('statusgruppe_id', $group); if ($contact->store()) { PageLayout::postMessage(MessageBox::success(_("Der Kontakt wurde aus der Gruppe entfernt."))); } } else { if ($contact->delete()) { PageLayout::postMessage(MessageBox::success(_("Der Kontakt wurde entfernt."))); } } } $this->redirect('contact/index/' . $group); }
/** * Remove the specified resource from storage. * * @return Response */ public function destroy($id) { return Contact::find($id)->delete(); }
public function delete($id) { $contact = Contact::find($id); $user = Auth::user(); $title = 'League Together - Contact'; return View::make('app.account.contact.delete')->with('page_title', $title)->with('contact', $contact)->withUser($user); }
public function deleteMessage($id) { $c = Contact::find($id); if (!$c) { return Redirect::back()->withErrors('Could not find Contact'); } $c->delete(); return Redirect::back(); }
public function contactName($id_contact) { $contact = Contact::find($id_contact); return $contact->fullname(); }
public function postDeleteFeedback($id = null) { if (!isset($id) or is_null($id)) { return Redirect::to('/admin/feedback'); } $feedback = Contact::find($id); if (is_null($feedback)) { return Redirect::to('/admin/feedback'); } $feedback->delete(); return Redirect::to('/admin/feedback'); }
<? require('../../inc/admin/config.php'); $session->auth_or_redirect('admin', '/', true); $admin_title = 'View Contact'; $pg = (!empty($_GET['pg'])) ? addslashes($_GET['pg']) : '1'; include(ROOT.'/inc/admin/header.php'); $contact = new Contact; $paginator = new Paginator($contact->find()); ?> <p><a href="/admin">Back to Admin Home</a></p> <div id="contact_index"> <table> <tr> <th>Name</th> <th>Email</th> <th>Subject</th> <th>Date Submitted</th> </tr> <?php foreach ($paginator->this_page() as $contact) { ?> <tr> <td><?php echo $contact->name; ?>
protected function saveModel($event = false) { if (Input::get('id')) { $event = Events::find(Input::get('id')); } if (!$event) { $event = new Events(); } $event->name = Input::get('name'); $event->proposed_opening_time = Input::get('proposed_opening_time'); $event->proposed_closing_time = Input::get('proposed_closing_time'); $event->proposed_local_sponsors = Input::get('proposed_local_sponsors'); $event->promotional_activities = Input::get('promotional_activities'); $event->eval_financial_score = Input::get('eval_financial_score'); $event->eval_financial_text = Input::get('eval_financial_text'); $event->eval_marketing_score = Input::get('eval_marketing_score'); $event->eval_marketing_text = Input::get('eval_marketing_text'); $event->eval_travel_score = Input::get('eval_travel_score'); $event->eval_travel_text = Input::get('eval_travel_text'); $event->eval_production_score = Input::get('eval_production_score'); $event->eval_production_text = Input::get('eval_production_text'); $event->eval_extra_text = Input::get('eval_extra_text'); // new stuff 1 $event->curfew = Input::get('curfew'); $event->minimal_age_limit = Input::get('minimal_age_limit'); $event->alcohol_license = Input::get('alcohol_license'); $event->restrictions_on_merchandise_sales = Input::get('restrictions_on_merchandise_sales'); $event->sound_restrictions = Input::get('sound_restrictions'); $event->booked_for_setup_from = Input::get('booked_for_setup_from'); $event->booked_for_break_until = Input::get('booked_for_break_until'); // new stuff 2 $event->hotel1_name = Input::get('hotel1_name'); $event->hotel2_name = Input::get('hotel2_name'); $event->hotel1_website = Input::get('hotel1_website'); $event->hotel2_website = Input::get('hotel2_website'); $event->hotel1_travel_time_from_airport = Input::get('hotel1_travel_time_from_airport'); $event->hotel2_travel_time_from_airport = Input::get('hotel2_travel_time_from_airport'); $event->hotel1_travel_time_from_venue = Input::get('hotel1_travel_time_from_venue'); $event->hotel2_travel_time_from_venue = Input::get('hotel2_travel_time_from_venue'); $event->ticketsystem_enabled = Input::get('ticketsystem_enabled'); $event->currency_id = Input::get('currency_id'); $event->ticketsystem_recording_startdate = Input::get('ticketsystem_recording_startdate'); $event->ticketsystem_locked_for_promoter = Input::get('ticketsystem_locked_for_promoter'); $event->ticketsystem_autoremind_user_id = Input::get('ticketsystem_autoremind_user_id'); $event->ticketsystem_autoremind = Input::get('ticketsystem_autoremind'); $event->save(); if (Input::get('event_date')) { //error_log('Event date '.json_encode(Input::get('event_date'))); $input_date = strtotime(Input::get('event_date')); $date = $event->date()->first(); if ($date) { // update current date $date->datetime_start = date("Y-m-d H:i:s", $input_date); $date->datetime_end = date("Y-m-d H:i:s", $input_date); $date->update(); } else { // create new date $event_date = new Dates(['datetime_start' => date("Y-m-d H:i:s", $input_date), 'datetime_end' => date("Y-m-d H:i:s", $input_date)]); $event_date->save(); $event->date()->attach($event_date); } $response = Event::fire('event.datechanged', array($event)); } if (Input::get('contact_id')) { $event->contacts()->detach(Contact::find(Input::get('contact_id'))); $event->contacts()->attach(Contact::find(Input::get('contact_id'))); } if (Input::get('venue_id')) { $event->venues()->detach(Venue::find(Input::get('venue_id'))); $event->venues()->attach(Venue::find(Input::get('venue_id'))); } if (Input::get('company_id')) { $event->companies()->detach(Company::find(Input::get('company_id'))); $event->companies()->attach(Company::find(Input::get('company_id'))); } if (Input::get('promoter_id')) { $event->users()->detach(User::find(Input::get('promoter_id'))); $event->users()->attach(User::find(Input::get('promoter_id'))); } return $event; }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $res = Contact::find($id); $res->delete(); return $res; }
function email_manager_passed($quiz, $scores) { // Import contacts model so i can grab user info why are users contacts? App::import('model', 'Contact'); $Cont = new Contact(); $user_info = $Cont->find('all', array('contain' => true, 'conditions' => array('Contact.user_id' => $_SESSION['Auth']['User']['id']))); // Get users Full name $user_name = $user_info[0]['Contact']['first_name'] . " " . $user_info[0]['Contact']['last_name']; // Build the email scores and email $headers = "From: fluent@fluentuniversity.com" . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $emailto = $user_info[0]['Contact']['man_email']; $subject = "{$user_name} just passed {$quiz['Quiz']['name']}"; $emailbody = "{$user_name} just passed <strong>{$quiz['Quiz']['name']}</strong> with a score of {$scores['score']} out of {$scores['total']}"; $mail = mail($emailto, $subject, $emailbody, $headers); }
$app->patch("/contacts/{id}", function ($id) use($app) { $contact_name = $_POST['contact_name']; $contact_phone_number = $_POST['contact_phone_number']; $contact_address = $_POST['contact_address']; $contact = Contact::find($id); $contact->update($contact_name, $contact_phone_number, $contact_address); return $app['twig']->render('contacts.html.twig', array('contact' => $contact->getContacts())); }); $app->patch("/categories/{id}", function ($id) use($app) { $name = $_POST['name']; $category = Category::find($id); $category->update($name); return $app['twig']->render('category.html.twig', array('category' => $category, 'contacts' => $category->getContacts())); }); $app->delete("/contacts/{id}", function ($id) use($app) { $contact = Contact::find($id); $contact->delete(); return $app['twig']->render('index.html.twig', array('contacts' => Contact::getAll())); }); $app->delete("/categories/{id}", function ($id) use($app) { $category = Category::find($id); $category->delete(); return $app['twig']->render('index.html.twig', array('categories' => Category::getAll())); }); $app->post("/contacts", function () use($app) { $contact_name = $_POST['contact_name']; $contact_phone_number = $_POST['contact_phone_number']; $contact_address = $_POST['contact_address']; $category_id = $_POST['category_id']; $contact = new Contact($contact_name, $contact_phone_number, $contact_address, $id = null, $category_id); $contact->save();
public function deleteContacto($id) { $contact = Contact::find($id); $contact->delete(); return Redirect::route('contacts.list'); }
public $relations = array('user' => array(self::BELONGS_TO, 'User', 'user_id')); } ActiveRecord::setDb(new PDO('sqlite:test.db')); ActiveRecord::execute("CREATE TABLE IF NOT EXISTS user (\n\t\t\t\tid INTEGER PRIMARY KEY, \n\t\t\t\tname TEXT, \n\t\t\t\tpassword TEXT \n\t\t\t);"); ActiveRecord::execute("CREATE TABLE IF NOT EXISTS contact (\n\t\t\t\tid INTEGER PRIMARY KEY, \n\t\t\t\tuser_id INTEGER, \n\t\t\t\temail TEXT,\n\t\t\t\taddress TEXT\n\t\t\t);"); /* $user = new User(); $user->name = 'demo'; $user->password = md5('demo'); var_dump($user->insert()); $contact = new Contact(); $contact->address = 'test'; $contact->email = '*****@*****.**'; $contact->user_id = $user->id; var_dump($contact->insert()); */ /* $contact = new Contact(); $contact->address = 'test'; $contact->email = '*****@*****.**'; $contact->user_id = 2; var_dump($contact->insert()); */ $user = new User(); var_dump($user->notnull('id')->orderby('id desc')->find()); echo "\nContact of User # {$user->id}\n"; var_dump($user->contacts); $contact = new Contact(); var_dump($contact->find()); var_dump($contact->users);