public function run()
 {
     $faker = Faker\Factory::create();
     for ($id = 1; $id < 19; $id++) {
         ContactInfo::create(['user_id' => $id, 'homenum' => $faker->randomElement(['6469330', '5320695', '1234567']), 'officenum' => $faker->randomElement(['8256325', '4598753', '3696542']), 'mobilenum' => '09064029842', 'street' => $faker->streetAddress, 'city' => $faker->randomElement(['Mandaluyong', 'Pasig'])]);
     }
 }
Esempio n. 2
0
 public function getPrimaryContactInfo()
 {
     $contact = ContactInfoPeer::getUserContactInfo($this->getUserId(), 'primary');
     if ($contact == null) {
         $contact = new ContactInfo();
         $contact->setTitle('Primary');
         $contact->setEmail($this->getsfGuardUser()->getUserName());
         $contact->setPrivacyLevel(sfConfig::get('app_profile_privacy_default'));
         $contact->setUserId($this->getUserId());
         $contact->save();
     }
     return $contact;
 }
 public function run()
 {
     Eloquent::unguard();
     $faker = Faker::create();
     foreach (range(1, 5) as $index) {
         $contactNumber = new ContactNumber(['type' => $faker->numberBetween(1, 3), 'number' => $faker->phoneNumber]);
         $contactInfo = ContactInfo::create(['address_1' => $faker->streetAddress, 'address_2' => $faker->streetName, 'zip' => $faker->postcode, 'email' => $faker->email]);
         $contactInfo->contactNumbers()->save($contactNumber);
         $customer = Customer::create(['name' => $faker->company, 'industry_type' => $faker->numberBetween(1, 3), 'secretary_id' => $faker->numberBetween(5, 7)]);
         $customer->contactInfo()->save($contactInfo);
         $representative = CustomerRepresentative::create(['first_name' => $faker->firstName, 'last_name' => $faker->lastName, 'middle_initial' => strtoupper($faker->randomLetter), 'company_position' => 'CEO']);
         $contactInfo = ContactInfo::create(['email' => $faker->email]);
         $contactNumber = new ContactNumber(['type' => $faker->numberBetween(1, 3), 'number' => $faker->phoneNumber]);
         $contactInfo->contactNumbers()->save($contactNumber);
         $representative->contactInfo()->save($contactInfo);
         $customer->representatives()->save($representative);
     }
 }
 /**
  * Store a newly created user in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make($data = Input::all(), User::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $role = array_pull($data, 'role');
     $contact = array_pull($data, 'contactInfo');
     $numbers = array_pull($contact, 'number');
     $numberTypes = array_pull($contact, 'number_type');
     $data['password'] = Hash::make($data['password']);
     $user = User::create($data);
     foreach ($numbers as $index => $number) {
         $contactNumbers[] = new ContactNumber(['number' => $number, 'type' => $numberTypes[$index]]);
     }
     $contactInfo = ContactInfo::create($contact);
     $contactInfo->contactNumbers()->saveMany($contactNumbers);
     // Attach Address
     $user->contactInfo()->save($contactInfo);
     // Attach role
     $user->roles()->sync([$role]);
     return Redirect::route('users.index')->with('message', 'Successfully added user')->with('alert-class', 'success');
 }
 public function run()
 {
     $faker = Faker::create();
     // Get roles
     $admin = Role::find(1);
     $secretary = Role::find(2);
     $technical = Role::find(3);
     $executive = Role::find(4);
     $procurement = Role::find(5);
     $contactNumber = new ContactNumber(['type' => $faker->numberBetween(1, 3), 'number' => $faker->phoneNumber]);
     $contactInfo = ContactInfo::create(['address_1' => $faker->streetAddress, 'address_2' => $faker->streetName, 'zip' => $faker->postcode, 'email' => $faker->email]);
     $contactInfo->contactNumbers()->save($contactNumber);
     $gat = User::create(['username' => 'Gatix', 'email' => '*****@*****.**', 'password' => Hash::make('Sand1gan'), 'first_name' => 'Gat', 'last_name' => 'Manuel', 'company_name' => 'Gatix', 'company_position' => 'Dev']);
     $gat->attachRoles([$admin, $secretary, $technical, $executive, $procurement]);
     $gat->contactInfo()->save($contactInfo);
     // Admins
     foreach (range(1, 3) as $index) {
         $contactNumber = new ContactNumber(['type' => $faker->numberBetween(1, 3), 'number' => $faker->phoneNumber]);
         $contactInfo = ContactInfo::create(['address_1' => $faker->streetAddress, 'address_2' => $faker->streetName, 'zip' => $faker->postcode, 'email' => $faker->email]);
         $contactInfo->contactNumbers()->save($contactNumber);
         $user = User::create(['username' => 'admin_' . $index, 'email' => $faker->email, 'first_name' => $faker->firstName, 'last_name' => $faker->lastName, 'middle_initial' => strtoupper($faker->randomLetter), 'company_name' => $faker->company, 'password' => Hash::make('password'), 'company_position' => 'Admin']);
         $user->attachRole($admin);
         $user->contactInfo()->save($contactInfo);
     }
     // Secretaries
     foreach (range(1, 3) as $index) {
         $contactNumber = new ContactNumber(['type' => $faker->numberBetween(1, 3), 'number' => $faker->phoneNumber]);
         $contactInfo = ContactInfo::create(['address_1' => $faker->streetAddress, 'address_2' => $faker->streetName, 'zip' => $faker->postcode, 'email' => $faker->email]);
         $contactInfo->contactNumbers()->save($contactNumber);
         $user = User::create(['username' => 'secretary_' . $index, 'email' => $faker->email, 'first_name' => $faker->firstName, 'last_name' => $faker->lastName, 'middle_initial' => strtoupper($faker->randomLetter), 'company_name' => $faker->company, 'password' => Hash::make('password'), 'company_position' => 'Secretary']);
         $user->attachRole($secretary);
         $user->contactInfo()->save($contactInfo);
     }
     // Technicals
     foreach (range(1, 3) as $index) {
         $contactNumber = new ContactNumber(['type' => $faker->numberBetween(1, 3), 'number' => $faker->phoneNumber]);
         $contactInfo = ContactInfo::create(['address_1' => $faker->streetAddress, 'address_2' => $faker->streetName, 'zip' => $faker->postcode, 'email' => $faker->email]);
         $contactInfo->contactNumbers()->save($contactNumber);
         $user = User::create(['username' => 'technical_' . $index, 'email' => $faker->email, 'first_name' => $faker->firstName, 'last_name' => $faker->lastName, 'middle_initial' => strtoupper($faker->randomLetter), 'company_name' => $faker->company, 'password' => Hash::make('password'), 'company_position' => 'Technical Reviewer']);
         $user->attachRole($technical);
         $user->contactInfo()->save($contactInfo);
     }
     // Executives
     foreach (range(1, 3) as $index) {
         $contactNumber = new ContactNumber(['type' => $faker->numberBetween(1, 3), 'number' => $faker->phoneNumber]);
         $contactInfo = ContactInfo::create(['address_1' => $faker->streetAddress, 'address_2' => $faker->streetName, 'zip' => $faker->postcode, 'email' => $faker->email]);
         $contactInfo->contactNumbers()->save($contactNumber);
         $user = User::create(['username' => 'executive_' . $index, 'email' => $faker->email, 'first_name' => $faker->firstName, 'last_name' => $faker->lastName, 'middle_initial' => strtoupper($faker->randomLetter), 'company_name' => $faker->company, 'password' => Hash::make('password'), 'company_position' => 'Executive']);
         $user->attachRole($executive);
         $user->contactInfo()->save($contactInfo);
     }
     // Procurement
     foreach (range(1, 3) as $index) {
         $contactNumber = new ContactNumber(['type' => $faker->numberBetween(1, 3), 'number' => $faker->phoneNumber]);
         $contactInfo = ContactInfo::create(['address_1' => $faker->streetAddress, 'address_2' => $faker->streetName, 'zip' => $faker->postcode, 'email' => $faker->email]);
         $contactInfo->contactNumbers()->save($contactNumber);
         $user = User::create(['username' => 'procurement_' . $index, 'email' => $faker->email, 'first_name' => $faker->firstName, 'last_name' => $faker->lastName, 'middle_initial' => strtoupper($faker->randomLetter), 'company_name' => $faker->company, 'password' => Hash::make('password'), 'company_position' => 'Procurement']);
         $user->attachRole($procurement);
         $user->contactInfo()->save($contactInfo);
     }
 }
Esempio n. 6
0
         $cid = $contactinfoid[$key];
     }
     if (empty($cid) && (empty($ctype) || empty($cinfo))) {
         continue 1;
     }
     try {
         if (empty($cid)) {
             $contact = new ContactInfo();
             $contact->setProperty('dataowneruserid', $dataowneruserid);
             $contact->setProperty('locationid', $locationid);
         } else {
             if (empty($cinfo)) {
                 ContactInfo::deleteInfo($cid, $userid);
                 continue 1;
             }
             $contact = ContactInfo::get($cid, $userid);
         }
         $contact->setProperty('contacttype', $ctype);
         $contact->setProperty('contactinfo', $cinfo, $ctype);
         $contact->setProperty('datachangebyuserid', $userid);
         $contact->save();
     } catch (Exception $e) {
         $errormessage = $e->getMessage();
         trigger_error($errormessage, E_USER_WARNING);
         $formmessage = $errormessage;
         $formmessageclass = 'red';
         break 2;
     }
 }
 $formmessage = 'Changes saved.';
 $formmessageclass = 'green';
Esempio n. 7
0
function lamtech_preprocess_node(&$vars)
{
    // kpr($vars);
    if (isset($vars['content']['field_category']) && count($vars['content']['field_category'])) {
        $vars['category'] = $vars['content']['field_category'][0];
        unset($vars['content']['field_category']);
    }
    $helper = NULL;
    switch ($vars['type']) {
        case 'cta':
            require_once DRUPAL_ROOT . '/' . drupal_get_path('theme', 'lamtech') . '/tpl/anb/cta/CTA.php';
            $helper = new CTA();
            $helper->preprocess($vars);
            break;
        case 'features_intro':
            require_once DRUPAL_ROOT . '/' . drupal_get_path('theme', 'lamtech') . '/tpl/anb/fi/FeaturesIntro.php';
            $helper = new FeaturesIntro();
            $helper->preprocess($vars);
            break;
        case 'gallery':
            require_once DRUPAL_ROOT . '/' . drupal_get_path('theme', 'lamtech') . '/tpl/anb/gallery/Gallery.php';
            $helper = new Gallery();
            $helper->preprocess($vars);
            break;
        case 'testimonials':
            require_once DRUPAL_ROOT . '/' . drupal_get_path('theme', 'lamtech') . '/tpl/anb/testimonials/Testimonials.php';
            $helper = new Testimonials();
            $helper->preprocess($vars);
            break;
        case 'hero':
            require_once DRUPAL_ROOT . '/' . drupal_get_path('theme', 'lamtech') . '/tpl/anb/hero/Hero.php';
            $helper = new Hero();
            $helper->preprocess($vars);
            break;
        case 'team':
            require_once DRUPAL_ROOT . '/' . drupal_get_path('theme', 'lamtech') . '/tpl/anb/team/Team.php';
            $helper = new Team();
            $helper->preprocess($vars);
            break;
        case 'statistic':
            require_once DRUPAL_ROOT . '/' . drupal_get_path('theme', 'lamtech') . '/tpl/anb/statistic/Statistic.php';
            $helper = new Statistic();
            $helper->preprocess($vars);
            break;
        case 'contact_info':
            require_once DRUPAL_ROOT . '/' . drupal_get_path('theme', 'lamtech') . '/tpl/anb/contact-info/ContactInfo.php';
            $helper = new ContactInfo();
            $helper->preprocess($vars);
            break;
        case 'advanced_page':
            unset($vars['content']['field_hide_title']);
            break;
    }
    // kpr($vars);
}
Esempio n. 8
0
 public function addContactInfo(ContactInfo $l)
 {
     $this->collContactInfos[] = $l;
     $l->setsfGuardUser($this);
 }
Esempio n. 9
0
 public function postDelete()
 {
     $info = ContactInfo::find(Input::get('id'));
     if ($info->delete()) {
         return Redirect::back()->with('event', '<p class="alert alert-success"><span class="glyphicon glyphicon-ok"></span> Contact info has been deleted successfully</p>');
     }
     return Redirect::back()->with('event', '<p class="alert alert-danger"><span class="glyphicon glyphicon-remove"></span> Error occured. Please try again</p>');
 }
Esempio n. 10
0
 public function getUserPdf($id)
 {
     $user = User::find($id);
     $comids = CommonId::where('user_id', $user->id)->first();
     $cont = ContactInfo::where('user_id', $user->id)->first();
     $parents = Parents::where('user_id', $user->id)->get();
     $schools = School::where('user_id', $user->id)->first();
     if ($user->gender == 'Male') {
         $gender = 'his';
     } else {
         $gender = 'her';
     }
     $audit = AuditTrail::create(['user_id' => Auth::id(), 'role' => 'User', 'action' => 'printed ' . $gender . ' User Information']);
     if (!$user) {
         App::abort(404);
     }
     Fpdf::AddPage();
     Fpdf::PageNo();
     Fpdf::AliasNbPages('{nb}');
     Fpdf::Image('img/dap.jpg', 10, 5, 150);
     Fpdf::SetFont('Arial', 'B', 10);
     Fpdf::Ln(25);
     Fpdf::Cell(300, 10, 'Date Generated: ' . date("F j, Y"), 0, 2, 'C', 0);
     Fpdf::SetFont('Arial', 'B', 18);
     Fpdf::Ln(10);
     Fpdf::Cell(190, 10, $user->formatName(':fn :ln'), 0, 2, 'C', 0);
     Fpdf::SetFont('Arial', 'B', 9.5);
     Fpdf::SetTextColor(0, 0, 0);
     Fpdf::Cell(80, 10, 'Personal Information', 0, 0, 'C', 0);
     Fpdf::Cell(80, 10, 'Common ID', 0, 1, 'C', 0);
     Fpdf::SetTextColor(0, 0, 0);
     Fpdf::SetFont('Arial', '', 8.5);
     Fpdf::Cell(80, 10, 'Email:   ' . $user->email, 0, 0, 'L', 0);
     Fpdf::Cell(80, 10, 'TIN ID:   ' . $comids->tin, 0, 1, 'L', 0);
     Fpdf::Cell(80, 10, 'Username:   '******'L', 0);
     Fpdf::Cell(80, 10, 'Philhealth:   ' . $comids->philhealth, 0, 1, 'L', 0);
     Fpdf::Cell(80, 10, 'Birthday:   ' . $user->birthday, 0, 0, 'L', 0);
     Fpdf::Cell(80, 10, 'Pag IBIG:   ' . $comids->pagibig, 0, 1, 'L', 0);
     Fpdf::Cell(80, 10, 'Gender:   ' . $user->gender, 0, 0, 'L', 0);
     Fpdf::Cell(80, 10, 'SSS:   ' . $comids->sss, 0, 1, 'L', 0);
     Fpdf::Cell(80, 10, 'Department:   ' . $user->department->name, 0, 0, 'L', 0);
     //Fpdf::Cell(80,10,'Common ID',0,2,'C',0);
     Fpdf::Ln(15);
     Fpdf::SetFont('Arial', 'B', 9.5);
     Fpdf::SetFillColor(90, 90, 90);
     Fpdf::SetTextColor(0, 0, 0);
     Fpdf::Cell(150, 10, 'Parents', 0, 1, 'C', 0);
     foreach ($parents as $parent) {
         if ($parent->parent_id == 1) {
             Fpdf::SetFont('Arial', '', 8.5);
             Fpdf::Cell(10, 10, 'Father', 0, 0, 'C', 0);
         } else {
             Fpdf::SetFont('Arial', '', 8.5);
             Fpdf::Cell(10, 10, 'Mother', 0, 0, 'C', 0);
         }
         Fpdf::Cell(65, 10, 'Name:   ' . $parent->firstname . " " . $parent->lastname, 0, 0, 'L', 0);
         Fpdf::Cell(65, 10, 'Address:   ' . $parent->address, 0, 1, 'L', 0);
     }
     Fpdf::Ln(15);
     Fpdf::SetFont('Arial', 'B', 9.5);
     Fpdf::Cell(150, 10, 'Contact Info', 0, 1, 'C', 0);
     Fpdf::SetFont('Arial', '', 8.5);
     Fpdf::Cell(80, 10, 'Home Number:   ' . $cont->homenum, 0, 0, 'L', 0);
     Fpdf::Cell(80, 10, 'Office Number:   ' . $cont->officenum, 0, 1, 'L', 0);
     Fpdf::Cell(80, 10, 'Mobile Number:   ' . $cont->mobilenum, 0, 0, 'L', 0);
     Fpdf::Cell(80, 10, 'Street:   ' . $cont->street, 0, 1, 'L', 0);
     Fpdf::Cell(80, 10, 'City:   ' . $cont->city, 0, 0, 'L', 0);
     Fpdf::Ln(5);
     Fpdf::Ln(5);
     Fpdf::SetFont('Arial', 'B', 9.5);
     Fpdf::SetFillColor(90, 90, 90);
     Fpdf::SetTextColor(0, 0, 0);
     Fpdf::Cell(180, 10, 'School', 0, 1, 'C', 0);
     Fpdf::SetTextColor(0, 0, 0);
     Fpdf::SetFont('Arial', '', 8.5);
     Fpdf::Cell(65, 10, 'Primary', 0, 0, 'C', 0);
     Fpdf::Cell(65, 10, 'Secondary', 0, 0, 'C', 0);
     Fpdf::Cell(65, 10, 'Tertiary', 0, 1, 'C', 0);
     Fpdf::Cell(65, 10, 'School:   ' . $schools->primary_name, 0, 0, 'L', 0);
     Fpdf::Cell(70, 10, 'School:   ' . $schools->secondary_name, 0, 0, 'L', 0);
     Fpdf::Cell(70, 10, 'School:   ' . $schools->tertiary_name, 0, 1, 'L', 0);
     Fpdf::Cell(65, 10, 'Address:  ' . $schools->primary_address, 0, 0, 'L', 0);
     Fpdf::Cell(70, 10, 'Address:   ' . $schools->secondary_address, 0, 0, 'L', 0);
     Fpdf::Cell(70, 10, 'Address: ' . $schools->tertiary_address, 0, 1, 'L', 0);
     Fpdf::Cell(65, 10, 'Years:   ' . $schools->primary_years, 0, 0, 'L', 0);
     Fpdf::Cell(70, 10, 'Years:   ' . $schools->secondary_years, 0, 0, 'L', 0);
     Fpdf::Cell(70, 10, 'Years:   ' . $schools->tertiary_years, 0, 1, 'L', 0);
     Fpdf::SetY(-30.5);
     Fpdf::SetFont('Arial', 'I', 6);
     Fpdf::SetTextColor(0, 0, 0);
     Fpdf::Cell(0, 10, 'Page ' . Fpdf::PageNo() . "/{nb}", 0, 0, 'C');
     Fpdf::Output();
     exit;
 }
Esempio n. 11
0
 if (isset($index_a[1]) && isset($index_a[2])) {
     if ($index_a[1] == "add") {
         require 'contact_info.class.php';
         $ci = new ContactInfo();
         $res = $ci->add($index_a[2]);
         if ($res == true) {
             header("Location: " . URL_ROOT . "info/users/" . $index_a[2]);
             echo "Vellykket.";
         } else {
             echo "Feilet<br>" . $ci->error;
         }
     } else {
         if ($index_a[1] == "delete") {
             if (isset($index_a[3])) {
                 require 'contact_info.class.php';
                 $ci = new ContactInfo();
                 $res = $ci->delete($index_a[2]);
                 if ($res == true) {
                     header("Location: " . URL_ROOT . "info/users/" . $index_a[3]);
                     echo "Vellykket.";
                 } else {
                     echo "Feilet<br>" . $ci->error;
                 }
             } else {
                 echo "Mangler obligatorisk variabel.";
             }
         } else {
             echo "Mangler obligatorisk variabel.";
         }
     }
 } else {
Esempio n. 12
0
 public function postEditContactInfo($id)
 {
     $user = User::find($id);
     $cont = ContactInfo::where('user_id', $id)->first();
     $validator = Validator::make(Input::all(), ContactInfo::$rules);
     if ($validator->fails()) {
         return Redirect::route('emp.edit-contactinfo', $cont->user_id)->withErrors($validator)->withInput();
     }
     $cont->update(['homenum' => Input::get('homenum'), 'officenum' => Input::get('officenum'), 'mobilenum' => Input::get('mobilenum'), 'street' => Input::get('street'), 'city' => Input::get('city')]);
     $audit = AuditTrail::create(['user_id' => Auth::id(), 'role' => 'Employee Management Admin', 'action' => 'edited ' . $user->firstname . ' ' . $user->lastname . '\'s Contact Information.']);
     return Redirect::route('profile', $id)->with('alert', 'success|Contact Info has been updated.');
 }
Esempio n. 13
0
 //They will only be set when the form is submitted.
 if (isset($_POST['customerName']) || isset($_POST['phoneNumber']) || isset($_POST['emailAddress']) || isset($_POST['referral'])) {
     if ($_POST['customerName'] == "") {
         $errorMessages['customerNameError'] = 'Please enter a customer name.';
         $hasError = true;
     }
     if (!is_numeric($_POST['phoneNumber']) || $_POST['phoneNumber'] == "") {
         $errorMessages['phoneNumberError'] = "Please enter a phone number.";
         $hasError = true;
     }
     if ($_POST['emailAddress'] == "") {
         $errorMessages['emailAddressError'] = "Please enter a email address.";
         $hasError = true;
     }
     if (!$hasError) {
         $contact = new ContactInfo("1", $_POST['customerName'], $_POST['phoneNumber'], $_POST['emailAddress'], $_POST['referral']);
         if ($contactDAO->dupEmail($contact->getEmail())) {
             echo '<span style=\'color:red\'>This is a duplicate email, please change another email.</span>';
         } else {
             $addSuccess = $contactDAO->addContact($contact);
             echo '<h3>' . $addSuccess . '</h3>';
         }
     }
 }
 if (isset($_POST['btnSubmit'])) {
     $target_path = "files/";
     $target_path = $target_path . basename($_FILES['myfile']['name']);
     if (move_uploaded_file($_FILES['myfile']['tmp_name'], $target_path)) {
         $fileUploaded = "The file " . basename($_FILES['myfile']['name']) . " has been uploaded";
         echo "<p>{$fileUploaded}</p>";
     } else {
Esempio n. 14
0
     $responseuri = $_POST['responseuri'];
     if (!isset($_POST['id'])) {
         header("Location: restaurants");
         exit;
     }
     $locationid = $_POST['id'];
     try {
         $location = Location::get($locationid, $userid);
         $locationname = $location->getProperty('name');
         $bhours = $location->getHours();
         foreach ($bhours as $bhourrow) {
             BusinessHour::deleteBusinessHour($bhourrow['id'], $userid);
         }
         $contactinfo = $location->getContactInfo();
         foreach ($contactinfo as $cirow) {
             ContactInfo::deleteInfo($cirow['id'], $userid);
         }
         Location::deleteLocation($locationid, $userid);
         $formmessage = 'Location "' . $locationname . '" deleted.';
         $formmessageclass = 'green';
         break;
     } catch (Exception $e) {
         $formmessage = $e->getMessage();
         trigger_error($formmessage);
         $formmessageclass = 'red';
         break;
     }
 } else {
     header("Location: logout");
     exit;
 }
Esempio n. 15
0
echo AdminFunctions::GetAdminActionUrl('panel', 'updatecontacts');
?>
" method="post" enctype="multipart/form-data">

        <?php 
if ($item != null) {
    ?>
            <input type="hidden" name="id" value="<?php 
    echo $item->id;
    ?>
">
        <?php 
} else {
    ?>
            <?php 
    $item = new ContactInfo();
    ?>
        <?php 
}
?>

        <label class="top-field-label">Эл. почта:</label>
        <div class="field-container-long"><input type="text" name="email_1" class="input-main float-left" value="<?php 
echo $item->email_1;
?>
"></div>
        <div class="hr"></div>

        <label class="top-field-label">Телефон:</label>
        <div class="field-container-long"><input type="text" name="phone_1" class="input-main float-left" value="<?php 
echo $item->phone_1;
Esempio n. 16
0
 public function contact()
 {
     return View::make('users.contact-us')->with('contact', ContactInfo::where('status', '=', 1)->get())->with('facebooks', ContactInfo::select('facebook')->where('status', '=', 1)->get())->with('twitters', ContactInfo::select('twitter')->where('status', '=', 1)->get())->with('googles', ContactInfo::select('google')->where('status', '=', 1)->get());
 }
 public function updateRepresentative($id)
 {
     $input = Input::all();
     /*echo "<pre>";
     		print_r($input);
     		die();*/
     foreach ($input['array'] as $key => $value) {
         $record = CustomerRepresentative::find($value['id']);
         $record->first_name = $value['first_name'];
         $record->middle_initial = $value['middle_initial'];
         $record->last_name = $value['last_name'];
         $record->company_position = $value['company_position'];
         $record->save();
         $email = ContactInfo::find($value['email_id']);
         $email->email = $value['email'];
         $email->save();
         $number = ContactNumber::find($value['number_id']);
         $number->number = $value['number'];
         $number->save();
         /*$contact = Contact::find($email->contact_id);
         		$contact->number = $value['new_number'];
         		$contact->save();*/
     }
     return Redirect::back()->with('message', 'Updated representative info')->with('alert-class', 'success');
 }
Esempio n. 18
0
 public function actionUpdateContacts()
 {
     /* @var $contacts ContactInfo */
     /* @var $contactsLng ContactInfoLng */
     $id = Yii::app()->request->getParam('id', null);
     $email_1 = Yii::app()->request->getParam('email_1', null);
     $phone_1 = Yii::app()->request->getParam('phone_1', null);
     $phone_2 = Yii::app()->request->getParam('phone_2', null);
     $email_admin = Yii::app()->request->getParam('email_admin', null);
     $small_text_lng = Yii::app()->request->getParam('info', array());
     $subject_lng = Yii::app()->request->getParam('subject', array());
     $contacts = ContactInfo::model()->findByPk($id);
     if ($contacts == null) {
         $contacts = new ContactInfo();
     }
     $contacts->email_1 = $email_1;
     $contacts->phone_1 = $phone_1;
     $contacts->phone_2 = $phone_2;
     $contacts->administrator_email = $email_admin;
     if ($contacts->isNewRecord) {
         $contacts->save();
     } else {
         $contacts->update();
     }
     foreach (Constants::GetLngArray() as $lng) {
         $contactsLng = $contacts->getLngObject($lng);
         $contactsLng->small_text = $small_text_lng[$lng];
         $contactsLng->feedback_subject = $subject_lng[$lng];
         if ($contactsLng->isNewRecord) {
             $contactsLng->save();
         } else {
             $contactsLng->update();
         }
     }
     $this->redirect($this->createUrl('/admin/panel/contacts'));
 }