public function contact_edit() { $id = $this->getParam(0, 0); $isPost = $this->request->isPost(); $errors = array(); $contact = new Contact(); if (!empty($id)) { $contact = Contact::get($id); if (empty($contact)) { throw new Exception('Undefined contact with id = [' . $id . ']'); } } // $id, $name, $action, $method, $class, $errors, $isPost $form = $contact->getForm('form-contact-admin', 'form-contact-admin', ROOT_HTTP . 'admin/contact', 'POST', 'form-horizontal', $errors, $isPost); $vars['form'] = $form; $this->render('admin/contact', $vars); }
function employee_get() { $filters = $this->get("filter")["filters"]; $data["results"] = array(); $data["count"] = 0; $obj = new Contact(null, $this->entity); $obj->where("contact_type_id", 3); $obj->get(); foreach ($obj as $value) { //Results $data["results"][] = array("id" => $value->id, "name" => $value->surname . ' ' . $value->name); } //Response Data $this->response($data, 200); }
</section> </div> <div class="colonne demi droite"> <section class="contenu demi"> <h4>Électeurs souhaitant donner une procuration</h4> <ul class="listeContacts"> <?php if ($data->procurationsNumber()) { // On fait la liste des contacts concernés $contacts = $data->contactsList(3); foreach ($contacts as $contact) { // On ouvre la fiche du contact concerné $fiche = new Contact(md5($contact[0])); if ($fiche->get('sexe') == 'H') { $sexe = 'homme'; } elseif ($fiche->get('sexe') == 'F') { $sexe = 'femme'; } else { $sexe = 'isexe'; } if (!empty($fiche->display_name())) { $nomAffichage = $fiche->display_name(); } elseif (!empty($fiche->get('organisme'))) { $nomAffichage = $fiche->get('organisme'); } else { $nomAffichage = 'Fiche sans nom'; } ?> <a href="<?php
// On protège la page User::protection(5); // On charge le contact if (isset($_GET['fiche'])) { $contact = new Contact(md5($_GET['fiche'])); } else { Core::goPage('contacts', true); } // On charge le template Core::loadHeader(); ?> <section id="fiche"> <header> <?php if (!empty($contact->get('contact_nom')) || !empty($contact->get('contact_nom_usage')) || !empty($contact->get('contact_prenoms'))) { ?> <h2><?php echo $contact->get('nom_affichage'); ?> </h2> <?php } elseif (!empty($contact->get('contact_organisme'))) { ?> <h2><?php echo $contact->get('contact_organisme'); ?> <?php } else { ?> <h2>Fiche sans nom</h2>
public function getCMSFields() { $fields = parent::getCMSFields(); if ($this->ID) { Session::set("FamilyID", $this->ID); } $nameField = TextField::create('Name', 'Family Name'); $fields->replaceField('Name', $nameField); $houseNoField = TextField::create('HouseNo', 'House No (govt)'); $fields->replaceField('HouseNo', $houseNoField); $parishes = Parish::get()->map('ID', 'NameWithLocation')->toArray(); $parishField = DropdownField::create('ParishID', 'Parish')->setSource($parishes); $parishField->setEmptyString('select...'); $fields->replaceField('ParishID', $parishField); //remove FamilyMembers tab $fields->removeByName('FamilyMembers'); $memberGridFieldConfig = GridFieldConfig_RecordEditor::create(); $familyMemberList = FamilyMember::get()->filter(array('FamilyID' => $this->ID))->sort('ID ASC'); $familyMemberGridField = new GridField('Members', 'Family members', $familyMemberList, $memberGridFieldConfig); $fields->addFieldsToTab('Root.Members', array($familyMemberGridField)); //house gridfield $houseGridFeildConfig = GridFieldConfig_RecordEditor::create(); $houseList = House::get()->filter(array('FamilyID' => $this->ID))->sort('ID ASC'); // remove add button if record already exists if ($houseList->count()) { $houseGridFeildConfig->removeComponentsByType('GridFieldAddNewButton'); } $houseGridField = new GridField('House', 'House', $houseList, $houseGridFeildConfig); $fields->addFieldsToTab('Root.Housing', array($houseGridField)); //land gridfield $landGridFeildConfig = GridFieldConfig_RecordEditor::create(); $landList = Land::get()->filter(array('FamilyID' => $this->ID))->sort('ID ASC'); // remove add button if record already exists if ($landList->count()) { $landGridFeildConfig->removeComponentsByType('GridFieldAddNewButton'); } $landGridField = new GridField('Land', 'Land', $landList, $landGridFeildConfig); $fields->addFieldsToTab('Root.Housing', array($landGridField)); //ShiftedFrom gridfield $shiftedFromGridFeildConfig = GridFieldConfig_RecordEditor::create(); $shiftedFromList = ShiftedFrom::get()->filter(array('FamilyID' => $this->ID))->sort('ID ASC'); // remove add button if record already exists if ($shiftedFromList->count()) { $shiftedFromGridFeildConfig->removeComponentsByType('GridFieldAddNewButton'); } $shiftedFromGridField = new GridField('Shifted', 'Shifted', $shiftedFromList, $shiftedFromGridFeildConfig); $fields->addFieldsToTab('Root.Housing', array($shiftedFromGridField)); //Agriculture gridfield $agricultureGridFeildConfig = GridFieldConfig_RecordEditor::create(); $agricultureList = Agriculture::get()->filter(array('FamilyID' => $this->ID))->sort('ID ASC'); // remove add button if record already exists if ($agricultureList->count()) { $agricultureGridFeildConfig->removeComponentsByType('GridFieldAddNewButton'); } $agricultureGridField = new GridField('Agriculture', 'Agriculture', $agricultureList, $agricultureGridFeildConfig); $fields->addFieldsToTab('Root.Occupation', array($agricultureGridField)); //Business gridfield $businessGridFeildConfig = GridFieldConfig_RecordEditor::create(); $businessList = Business::get()->filter(array('FamilyID' => $this->ID))->sort('ID ASC'); // remove add button if record already exists if ($businessList->count()) { $businessGridFeildConfig->removeComponentsByType('GridFieldAddNewButton'); } $businessGridField = new GridField('Business', 'Business', $businessList, $businessGridFeildConfig); $fields->addFieldsToTab('Root.Occupation', array($businessGridField)); //MonthlyIncome gridfield $monthlyIncomeGridFeildConfig = GridFieldConfig_RecordEditor::create(); $monthlyIncomeList = MonthlyIncome::get()->filter(array('FamilyID' => $this->ID))->sort('ID ASC'); // remove add button if record already exists if ($monthlyIncomeList->count()) { $monthlyIncomeGridFeildConfig->removeComponentsByType('GridFieldAddNewButton'); } $monthlyIncomeGridField = new GridField('MonthlyIncome', 'MonthlyIncome', $monthlyIncomeList, $monthlyIncomeGridFeildConfig); $fields->addFieldsToTab('Root.Monthly', array($monthlyIncomeGridField)); //MonthlyExpense gridfield $monthlyExpenseGridFeildConfig = GridFieldConfig_RecordEditor::create(); $monthlyExpenseList = MonthlyExpense::get()->filter(array('FamilyID' => $this->ID))->sort('ID ASC'); // remove add button if record already exists if ($monthlyExpenseList->count()) { $monthlyExpenseGridFeildConfig->removeComponentsByType('GridFieldAddNewButton'); } $monthlyExpenseGridField = new GridField('MonthlyExpense', 'MonthlyExpense', $monthlyExpenseList, $monthlyExpenseGridFeildConfig); $fields->addFieldsToTab('Root.Monthly', array($monthlyExpenseGridField)); //Vehicle gridfield $vehicleGridFeildConfig = GridFieldConfig_RecordEditor::create(); $vehicleList = Vehicle::get()->filter(array('FamilyID' => $this->ID))->sort('ID ASC'); // remove add button if record already exists if ($vehicleList->count()) { $vehicleGridFeildConfig->removeComponentsByType('GridFieldAddNewButton'); } $vehicleGridField = new GridField('Vehicle', 'Vehicle', $vehicleList, $vehicleGridFeildConfig); $fields->addFieldsToTab('Root.OtherDetails', array($vehicleGridField)); //Appliance gridfield $applianceGridFeildConfig = GridFieldConfig_RecordEditor::create(); $applianceList = Appliance::get()->filter(array('FamilyID' => $this->ID))->sort('ID ASC'); // remove add button if record already exists if ($applianceList->count()) { $applianceGridFeildConfig->removeComponentsByType('GridFieldAddNewButton'); } $applianceGridField = new GridField('Appliance', 'Appliance', $applianceList, $applianceGridFeildConfig); $fields->addFieldsToTab('Root.OtherDetails', array($applianceGridField)); //OtherFacility gridfield $otherFacilityGridFeildConfig = GridFieldConfig_RecordEditor::create(); $otherFacilityList = OtherFacility::get()->filter(array('FamilyID' => $this->ID))->sort('ID ASC'); // remove add button if record already exists if ($otherFacilityList->count()) { $otherFacilityGridFeildConfig->removeComponentsByType('GridFieldAddNewButton'); } $otherFacilityGridField = new GridField('OtherFacility', 'Other Facility', $otherFacilityList, $otherFacilityGridFeildConfig); $fields->addFieldsToTab('Root.OtherDetails', array($otherFacilityGridField)); //Media gridfield $mediaGridFieldConfig = GridFieldConfig_RecordEditor::create(); $mediaList = Media::get()->filter(array('FamilyID' => $this->ID))->sort('ID ASC'); // remove add button if record already exists if ($mediaList->count()) { $mediaGridFieldConfig->removeComponentsByType('GridFieldAddNewButton'); } $mediaGridField = new GridField('Media', 'Media', $mediaList, $mediaGridFieldConfig); $fields->addFieldsToTab('Root.OtherDetails', array($mediaGridField)); //CatholicMagazine gridfield $catholicMagazineGridFieldConfig = GridFieldConfig_RecordEditor::create(); $catholicMagazineList = CatholicMagazine::get()->filter(array('FamilyID' => $this->ID))->sort('ID ASC'); // remove add button if record already exists if ($catholicMagazineList->count()) { $catholicMagazineGridFieldConfig->removeComponentsByType('GridFieldAddNewButton'); } $catholicMagazineGridField = new GridField('CatholicMagazine', 'Catholic Magazine', $catholicMagazineList, $catholicMagazineGridFieldConfig); $fields->addFieldsToTab('Root.OtherDetails', array($catholicMagazineGridField)); //Loan gridfield $loanGridFieldConfig = GridFieldConfig_RecordEditor::create(); $loanList = Loan::get()->filter(array('FamilyID' => $this->ID))->sort('ID ASC'); // remove add button if record already exists if ($loanList->count()) { $loanGridFieldConfig->removeComponentsByType('GridFieldAddNewButton'); } $loanGridField = new GridField('Loan', 'Loan', $loanList, $loanGridFieldConfig); $fields->addFieldsToTab('Root.Financial', array($loanGridField)); //Saving gridfield $savingGridFieldConfig = GridFieldConfig_RecordEditor::create(); $savingList = Saving::get()->filter(array('FamilyID' => $this->ID))->sort('ID ASC'); // remove add button if record already exists if ($savingList->count()) { $savingGridFieldConfig->removeComponentsByType('GridFieldAddNewButton'); } $savingGridField = new GridField('Saving', 'Saving', $savingList, $savingGridFieldConfig); $fields->addFieldsToTab('Root.Financial', array($savingGridField)); //Talent gridfield $talentGridFieldConfig = GridFieldConfig_RecordEditor::create(); $talentList = Talent::get()->filter(array('FamilyID' => $this->ID))->sort('ID ASC'); // remove add button if record already exists if ($talentList->count()) { $talentGridFieldConfig->removeComponentsByType('GridFieldAddNewButton'); } $talentGridField = new GridField('Talent', 'Talent', $talentList, $talentGridFieldConfig); $fields->addFieldsToTab('Root.Members', array($talentGridField)); //Contact gridfield $contactGridFieldConfig = GridFieldConfig_RecordEditor::create(); $contactList = Contact::get()->filter(array('FamilyID' => $this->ID))->sort('ID ASC'); // remove add button if record already exists if ($contactList->count()) { $contactGridFieldConfig->removeComponentsByType('GridFieldAddNewButton'); } $contactGridField = new GridField('Contact', 'Contact', $contactList, $contactGridFieldConfig); $fields->addFieldsToTab('Root.Contact', array($contactGridField)); return $fields; }
?> <h2>Résultats</h2> <ul class="listeEncadree"> <?php foreach ($contacts as $c) { $contact = new Contact(md5($c[0])); ?> <li class="electeur"> <?php if (isset($_GET['destination']) && $_GET['destination'] == 'interaction') { ?> <a href="<?php Core::goPage('interaction', array('action' => 'ajout', 'fiche' => $contact->get('contact_id'))); ?> " class="nostyle"> <?php } else { ?> <a href="<?php Core::goPage('contacts', array('fiche' => $contact->get('contact_id'))); ?> " class="nostyle"> <?php } ?> <strong><?php echo $contact->get('nom_affichage');
require __DIR__ . "/models/Post.php"; require __DIR__ . "/models/Tag.php"; $date = date('Y-m-d'); // Configure Phormium \Phormium\DB::configure('config.json'); // Create a person and three contacts Person::fromArray(["id" => 1, "name" => "Ivan"])->save(); Contact::fromArray(["id" => 1, "person_id" => 1, "value" => "foo"])->save(); Contact::fromArray(["id" => 2, "person_id" => 1, "value" => "bar"])->save(); Contact::fromArray(["id" => 3, "person_id" => 1, "value" => "baz"])->save(); // Fetch the person, then get her contacts $person = Person::get(1); $contacts = $person->contacts()->fetch(); print_r($contacts); // Fetch the contact, then get the person it belongs to $contact = Contact::get(1); $person = $contact->person()->single(); print_r($person); // Create a post and three tags Post::fromArray(["date" => $date, "no" => 1, "title" => "Post #1"])->save(); Tag::fromArray(["id" => 1, "post_date" => $date, "post_no" => 1, "value" => "Tag #1"])->save(); Tag::fromArray(["id" => 2, "post_date" => $date, "post_no" => 1, "value" => "Tag #2"])->save(); Tag::fromArray(["id" => 3, "post_date" => $date, "post_no" => 1, "value" => "Tag #3"])->save(); // Fetch a post, then fetch it's tags $post = Post::get($date, 1); $tags = $post->tags()->fetch(); print_r($tags); // Fetch a tag, then fetch the post it belongs to $tag = Tag::get(2); $post = $tag->post()->single(); print_r($post);
public function all($parameters = array()) { $response = new Response(Contact::get(self::base_uri(), $parameters)); self::handle_collection($response); return $response; }
// On récupère les informations $infos = array('titre' => $_GET['titre'], 'message' => $_GET['message']); // On va commencer par créer la campagne $idCampagne = Campagne::creation('email', $infos); // On ouvre ensuite cette campagne $campagne = new Campagne(md5($idCampagne)); // On récupère les données $var = $_GET; // On retraite les critères complexes $var['criteres'] = trim($var['criteres'], ';'); // On charge les fiches correspondantes $contacts = Contact::listing($var, 0, false); $listing = array(); // Pour chaque fiche, on créé un envoi foreach ($contacts as $contact) { // On ouvre la fiche contact pour récupérer le numéro de téléphone $c = new Contact(md5($contact)); unset($mobile); // On démarre l'instance Mail $listing[] = array('email' => $c->get('email'), 'name' => $c->get('nom_affichage'), 'type' => 'to'); } // On charge le système de mail $mail = Configuration::read('mail'); // On prépare le message $message = array('html' => nl2br($infos['message']), 'subject' => $infos['titre'], 'from_email' => '*****@*****.**', 'from_name' => 'LeQG', 'to' => $listing, 'headers' => array('Reply-To' => '*****@*****.**'), 'track_opens' => true, 'auto_text' => true); // mode asynchrone d'envoi du mail $async = true; // on lance l'envoi du mail $result = $mail->messages->send($message, $async); Core::debug($result, false); }
?> <?php if ($data->newContactsNumber()) { ?> <section id="procurations" class="contenu demi"> <h4>Électeurs souhaitant être recontactés</h4> <ul class="listeContacts"> <?php // On fait la liste des contacts concernés $contacts = $data->contactsList(4); foreach ($contacts as $contact) { // On ouvre la fiche du contact concerné $fiche = new Contact(md5($contact[0])); if ($fiche->get('contact_sexe') == 'M') { $sexe = 'homme'; } elseif ($fiche->get('contact_sexe') == 'F') { $sexe = 'femme'; } else { $sexe = 'isexe'; } if (!empty($fiche->get('nom_affichage'))) { $nomAffichage = $fiche->get('nom_affichage'); } elseif (!empty($fiche->get('contact_organisme'))) { $nomAffichage = $fiche->get('contact_organisme'); } else { $nomAffichage = 'Fiche sans nom'; } ?> <a href="<?php
if (!isset($_GET['electeur'])) { Core::goPage('reporting', array('mission' => $_GET['mission']), true); } // typologie $typologie = $data->get('mission_type') == 'porte' ? 'porte' : 'boite'; // On charge le header Core::loadHeader(); ?> <h2>Mission « <?php echo $data->get('mission_nom'); ?> »</h2> <h3 style="margin: 20px;"><?php echo mb_convert_case($contact->get('contact_nom'), MB_CASE_UPPER) . ' ' . mb_convert_case($contact->get('contact_nom_usage'), MB_CASE_UPPER) . ' ' . mb_convert_case($contact->get('contact_prenoms'), MB_CASE_TITLE); ?> </h3> <a href="<?php Core::goPage('report', array('code' => $_GET['code'], 'rue' => $_GET['rue'], 'immeuble' => $_GET['immeuble'], 'electeur' => $_GET['electeur'], 'statut' => 1)); ?> " class="nostyle bouton">Absent</a> <a href="<?php Core::goPage('report', array('code' => $_GET['code'], 'rue' => $_GET['rue'], 'immeuble' => $_GET['immeuble'], 'electeur' => $_GET['electeur'], 'statut' => 2)); ?> " class="nostyle bouton">Ouvert</a> <a href="<?php Core::goPage('report', array('code' => $_GET['code'], 'rue' => $_GET['rue'], 'immeuble' => $_GET['immeuble'], 'electeur' => $_GET['electeur'], 'statut' => 3)); ?> " class="nostyle bouton">Demande procuration</a>
/** * GET /contacts * 自分のコンタクト一覧を取得. * * 引数:なし */ public function fetchContacts() { $this->loadModel('Chatwork.Contact'); $results = Contact::get(array()); $this->out(print_r($results, true)); }