Ejemplo n.º 1
0
 public function showMemberContacts()
 {
     $memberCollection = array();
     if (Auth::user()->isAdmin()) {
         $contacts = Contact::all();
     } else {
         $contacts = Contact::where('user_id', Auth::user()->id)->get();
         $memberCollection = MemberAPI::getmemberapiselect(Auth::user()->id);
         foreach ($memberCollection as $member) {
             if (!User::find($member->member_id)) {
                 $user = new User();
                 $user->id = $member->member_id;
                 $user->username = $member->username;
                 $user->name = $member->name;
                 $user->password = Hash::make(rand());
                 $user->active = 1;
                 $user->save();
             }
             $membercontacts = Contact::where('user_id', $member->member_id)->get();
             $contacts = $contacts->merge($membercontacts);
         }
         // return $contacts->toJson();
     }
     return View::make('contacts.member', compact('contacts', 'memberCollection'));
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     return Contact::all();
 }
Ejemplo n.º 3
0
<?php

require APP_PATH . '/models/Contact.php';
$web = 'http://adsiar.com';
$contactTable = new Contact();
$contacts = $contactTable->all();
view('contacto', compact('web', 'contacts'));
Ejemplo n.º 4
0
 public function get_contacts()
 {
     return Contact::all();
 }
Ejemplo n.º 5
0
 public function showcontacts()
 {
     return View::make('contacts.showcontacts')->with('title', 'contacts')->with('contacts', Contact::all());
     // display contacts
 }
Ejemplo n.º 6
0
function all($request)
{
    $contact = new Contact();
    $list = $contact->all($contact);
    echo json_encode($list);
}
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $fetchedContacts = Contact::all();
     return $fetchedContacts;
 }
Ejemplo n.º 8
0
			</div>
			<div class="form-group">
		    	<button type="submit" name="submit" class="btn btn-primary"><?php 
        _e('main.save_changes');
        ?>
</button>
		    </div>
		</form>
		<br>
		<h4><?php 
        _e('main.contacts');
        ?>
</h4>
		<ul class="list-group contact-list">
			<?php 
        foreach (Contact::all(Auth::user()->id) as $contact) {
            ?>
				<li class="list-group-item <?php 
            echo empty($contact['accepted']) ? '' : 'contact-confirmed';
            ?>
" data-contact-id="<?php 
            echo $contact['id'];
            ?>
">
					<a href="<?php 
            echo App::url("profile.php?u={$contact['id']}");
            ?>
" target="_blank">
						<img src="<?php 
            echo $contact['avatar'];
            ?>
Ejemplo n.º 9
0
 public function getManager($section = null)
 {
     if (Auth::user()->level == 1) {
         if ($section == 'clients') {
             $clients = Client::findParentClients();
             $executive = new Client();
             $this->layout->content = View::make('pages.clients', array('clients' => $clients, 'users' => $executive->executiveList()));
         } elseif ($section == 'contacts') {
             $contacts = Contact::all();
             $contact = new Contact();
             $this->layout->content = View::make('pages.contacts', array('contacto' => $contact, 'contacts' => $contacts, 'clients' => $contact->clientList()));
         } elseif ($section == 'users') {
             $users = User::all();
             $this->layout->content = View::make('pages.users', array('users' => $users));
         } else {
             $status = Status::findStatus($_GET);
             $clientsList = Client::findClientsList();
             $executive = new Client();
             $magazine = Magazine::listMagazine();
             $edition = range(0, 200);
             $edition[0] = 'Edición';
             $stat = new Status();
             $this->layout->content = View::make('pages.statusManager', array('estatus' => $stat, 'status' => $status, 'magazine' => $magazine, 'edition' => $edition, 'clients' => $clientsList, 'executive' => $executive->executiveList()));
         }
     } else {
         return Redirect::to('home')->with('message', 'Debes iniciar sesión para continuar.');
     }
 }
Ejemplo n.º 10
0
 /**
  * Muestra la lista de contactos
  */
 public function listContactos()
 {
     $contactos = Contact::all();
     return View::make('contactos.lista', array('contactos' => $contactos));
 }
 public function viewContacts()
 {
     $allContacts = Contact::all();
     return View::make('contacts.view-contacts', array('contacts' => $allContacts));
 }
Ejemplo n.º 12
0
    $html = (require_once '../views/main.html');
    $response->write($html);
    return $response;
});
$app->post('/contacts', function ($request, $response, $args) {
    // add contact to db
    $newContact = $request->getParsedBody();
    $contact = new Contact();
    $contact->name = $newContact['name'];
    $contact->email = $newContact['email'];
    $contact->number = $newContact['number'];
    $contact->save();
    return $response;
});
$app->get('/contacts', function ($request, $response, $args) {
    $response->withJson(Contact::all());
    return $response;
});
$app->get('/contacts/{id}', function ($request, $response, $args) {
    $contact = Contact::find($args['id']);
    $response->write($contact->toJson());
    return $response;
});
$app->put('/contacts/{id}', function ($request, $response, $args) {
    $editedContact = $request->getParsedBody();
    $contact = Contact::find($args['id']);
    $contact->name = $editedContact['name'];
    $contact->email = $editedContact['email'];
    $contact->number = $editedContact['number'];
    $contact->save();
    return $response;
Ejemplo n.º 13
0
    if (is_array($d)) {
        return array_map(__FUNCTION__, $d);
    } else {
        return $d;
    }
}
$contactList = new \Slim\Slim();
use Illuminate\Database\Capsule\Manager as Capsule;
$capsule = new Capsule();
$capsule->addConnection(array('driver' => 'mysql', 'host' => 'localhost', 'database' => 'contactList', 'username' => 'root', 'password' => 'root', 'charset' => 'utf8', 'collation' => 'utf8_general_ci'));
$capsule->bootEloquent();
$capsule->setAsGlobal();
$conn = $capsule->connection();
// Get all contacts
$contactList->get('/contacts', function () use($contactList) {
    $contacts = Contact::all();
    foreach ($contacts as $chave => $valor) {
        $dados[$chave] = json_decode($valor);
        $phones = Phone::where('contactId', '=', $dados[$chave]->id)->get();
        $dados[$chave]->phones = json_decode($phones);
        $addresses = Address::where('contactId', '=', $dados[$chave]->id)->get();
        $dados[$chave]->addresses = json_decode($addresses);
    }
    $contactList->response()->header('Content-Type', 'application/json');
    echo json_encode($dados);
});
// Get contacts page
$contactList->get('/contacts/page/:p/:rpp', function ($p, $rpp) use($contactList) {
    $pagina = $p - 1;
    $skip = $pagina * $rpp;
    $contacts = Contact::take($rpp)->skip($skip)->get();
Ejemplo n.º 14
0
 function showAll()
 {
     $contact = Contact::all();
     echo json_encode($contact);
 }
Ejemplo n.º 15
0
function ajax_get_contacts()
{
    if (Auth::guest()) {
        exit;
    }
    json_message(Contact::all(Auth::user()->id));
}