当前位置: 首页>>代码示例>>PHP>>正文


PHP Person::find方法代码示例

本文整理汇总了PHP中Person::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Person::find方法的具体用法?PHP Person::find怎么用?PHP Person::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Person的用法示例。


在下文中一共展示了Person::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getSearchResult

 /**
  * Assign necessary Smarty variables and return a template name to
  * load in order to display a summary of the item suitable for use in
  * search results.
  *
  * @access  public
  * @return  string              Name of Smarty template file to display.
  */
 public function getSearchResult()
 {
     global $configArray;
     global $interface;
     $id = $this->getUniqueID();
     $interface->assign('summId', $id);
     $shortId = substr($id, 6);
     $interface->assign('summShortId', $shortId);
     //Trim the list prefix for the short id
     $person = new Person();
     $person->personId = $shortId;
     $person->find();
     if ($person->N > 0) {
         $person->fetch();
         $person = Person::staticGet('personId', $shortId);
         $interface->assign('summPicture', $person->picture);
     }
     $name = $this->getName();
     $interface->assign('summTitle', trim($name));
     $interface->assign('birthDate', $person->formatPartialDate($person->birthDateDay, $person->birthDateMonth, $person->birthDateYear));
     $interface->assign('deathDate', $person->formatPartialDate($person->deathDateDay, $person->deathDateMonth, $person->deathDateYear));
     $interface->assign('lastUpdate', $person->lastModified);
     $interface->assign('dateAdded', $person->dateAdded);
     $interface->assign('numObits', count($person->obituaries));
     return 'RecordDrivers/Person/result.tpl';
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:34,代码来源:PersonRecord.php

示例2: addPersonToTraining

 /**
  * Add person to training session
  */
 public function addPersonToTraining($person_id, $training_id)
 {
     $select = $this->select()->from($this->_name, array('doesExist' => 'COUNT(*)'))->setIntegrityCheck(false)->where("person_id = {$person_id} AND training_id = {$training_id}");
     $row = $this->fetchRow($select);
     if ($row->doesExist) {
         return -1;
     } else {
         //make sure person isn't deleted
         $person = new Person();
         $prows = $person->find($person_id);
         if ($prows) {
             $prow = $prows->current();
         }
         if (!$prows || !$prow || $prow->is_deleted) {
             return 0;
         }
         $data['person_id'] = $person_id;
         $data['training_id'] = $training_id;
         try {
             return $this->insert($data);
         } catch (Zend_Exception $e) {
             error_log($e);
         }
     }
 }
开发者ID:falafflepotatoe,项目名称:trainsmart-code,代码行数:28,代码来源:PersonToTraining.php

示例3: launch

 function launch()
 {
     global $configArray;
     global $interface;
     //Check to see if we are doing the reindex.  If so, we need to do it in batches
     //Because PHP will time out doing the full reindex, break up into chunks of 25 records at a time.
     //Process is as follows:
     //1. Display form for the user to start the reindex process
     //2. System loads the total nummber of records in the database
     //5. Total number of records in the database are stored in the session with the filename and current status
     //6. Information sent back to browser with number of records, etc.
     //7. Browser does AJAX callbacks to run each batch and update progress bar when each finishes. (in JSON.php)
     //8. Separate action available to cancel the batch
     if (isset($_REQUEST["submit"])) {
         $person = new Person();
         $person->find();
         $numRecords = $person->N;
         $_SESSION['genealogyDateFix']['currentRecord'] = 0;
         $_SESSION['genealogyDateFix']['numRecords'] = $numRecords;
         $interface->assign('startDateFix', true);
         $interface->assign('numRecords', $numRecords);
         $interface->assign('percentComplete', 0);
     }
     $interface->setTemplate('genealogyFixDates.tpl');
     $interface->setPageTitle('Fix Dates in Genalogy Information');
     $interface->display('layout.tpl');
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:27,代码来源:GenealogyFixDates.php

示例4: destroy

 public static function destroy()
 {
     $params = $_POST;
     $user_id = $params['user_id'];
     $user_to_destroy = Person::find($user_id);
     $user_to_destroy->destroy();
     Redirect::to('/usermanagement', array('message' => 'User removed'));
     View::make('notimplemented.html');
 }
开发者ID:juhapekkamoilanen,项目名称:Tsoha-Bootstrap,代码行数:9,代码来源:user_controller.php

示例5: getAllObjects

 function getAllObjects()
 {
     $object = new Person();
     $object->orderBy('lastName, firstName');
     $object->find();
     $objectList = array();
     while ($object->fetch()) {
         $objectList[$object->personId] = clone $object;
     }
     return $objectList;
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:11,代码来源:People.php

示例6: get_user_logged_in

 public static function get_user_logged_in()
 {
     //katsotaan onko session-globaaliin tallennettu 'user'-avainta
     if (isset($_SESSION['user'])) {
         //jos on niin niin poimitaan sen arvo
         $user_id = $_SESSION['user'];
         //ja luodaan olio user-luokan find-metodilla
         $user_object = Person::find($user_id);
         return $user_object;
     }
     //ei löytynyt eli käyttäjä ei ole kirjautunut
     return null;
 }
开发者ID:juhapekkamoilanen,项目名称:Tsoha-Bootstrap,代码行数:13,代码来源:base_controller.php

示例7: countStatisticsById

 /**
  * Calculates the sum of all shifts in a given period for a given person id.
  *
  * @return int 		$subjectTotal
  */
 public function countStatisticsById($id, $from, $till)
 {
     // get all events for the month, currently jan15 for testing
     $events = ClubEvent::where('evnt_date_start', '>', $from)->where('evnt_date_start', '<', $till)->get();
     $subject = Person::find($id);
     $subjectTotal = 0;
     foreach ($events as $event) {
         // for each event - get its schedule
         $schedule = Schedule::findOrFail($event->getSchedule->id);
         // for each schedule - get its entries that have this person's id
         $entries = ScheduleEntry::where('schdl_id', '=', $schedule->id)->where('prsn_id', '=', $subject->id)->get();
         // for each entry - get its job type weight
         foreach ($entries as $entry) {
             $weight = $entry->getJobType->jbtyp_statistical_weight;
             //and add it to subject's total
             $subjectTotal += $weight;
         }
     }
     return $subjectTotal;
 }
开发者ID:gitter-badger,项目名称:lara-vedst,代码行数:25,代码来源:StatisticsController.php

示例8: launch

 function launch()
 {
     global $interface;
     global $configArray;
     global $user;
     global $timer;
     $timer->logTime("Starting to reindex person");
     $recordId = $_REQUEST['id'];
     $quick = isset($_REQUEST['quick']) ? true : false;
     $person = new Person();
     $person->personId = $recordId;
     if ($person->find(true)) {
         $ret = $person->saveToSolr($quick);
         if ($ret) {
             echo json_encode(array("success" => true));
         } else {
             echo json_encode(array("success" => false, "error" => "Could not update solr"));
         }
     } else {
         echo json_encode(array("success" => false, "error" => "Could not find a record with that id"));
     }
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:22,代码来源:Reindex.php

示例9:

         $row = Event::find($id);
         $row->delete();
     } else {
         // Set error.
         $error = "CantDeleteEvent";
         $message = "The event could not be deleted since some assistance lists are linked to him";
         $statusCode = 422;
     }
 }
 // Person.
 if ($type == "person") {
     // Verify if the person is used by assistances.
     $count = Assistance::count(array('conditions' => 'person_id = ' . $id));
     if ($count <= 0) {
         // Delete person.
         $row = Person::find($id);
         $row->delete();
     } else {
         // Set error.
         $error = "CantDeletePerson";
         $message = "The person could not be deleted since some assistance lists are linked to him";
         $statusCode = 422;
     }
 }
 // User.
 if ($type == "user") {
     // Verify if the user is used by assistances.
     $count = Assistance::count(array('conditions' => 'user_id = ' . $id));
     if ($count <= 0) {
         // Delete officer.
         $row = User::find($id);
开发者ID:jfmdev,项目名称:AttendanceTaker,代码行数:31,代码来源:api.svcs.edit.php

示例10: edit

 /**
  * Show the form for editing the specified person.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $person = Person::find($id);
     return View::make('people.edit', compact('person'));
 }
开发者ID:C-a-p-s-t-o-n-e,项目名称:capstone.dev,代码行数:11,代码来源:PeopleController.php

示例11: Person

<?php

require_once '../../include.php';
$type = $_GET['type'];
$_person = new Person();
$persons = $_person->find($type, 15, 0);
?>
<div class="loading">
	<img src="<?php 
echo HOSTURL;
?>
static/images/loading.gif"/>
</div>
<?php 
if (count($persons) < 1) {
    echo "尚无数据。";
}
?>
<ul class="person-list">	
	<?php 
foreach ($persons as $i) {
    ?>
	<li pid="<?php 
    echo $i['id'];
    ?>
">
		<a class="item" href="javascript:void(0);"><?php 
    echo $i['name'];
    ?>
</a>
		<div class="person_click_loading hide">
开发者ID:newmight2015,项目名称:housegis,代码行数:31,代码来源:left_person_list.php

示例12: assignTrainingAction

 /**
  * List trainings and allow person to be assigned
  */
 public function assignTrainingAction()
 {
     $id = $this->getSanParam('id');
     $this->view->assign('id', $id);
     $maxAge = $this->getSanParam('maxage');
     $this->view->assign('maxage', $maxAge);
     $person = new Person();
     $rows = $person->find($id);
     $row = $rows->current();
     $this->view->assign('person_row', $row);
     require_once 'models/table/Training.php';
     $tableObj = new Training();
     $age = "training_start_date < NOW() AND training_start_date > DATE_SUB(NOW(), INTERVAL 30 DAY)";
     switch ($maxAge) {
         case '60days':
             $age = "training_start_date < NOW() AND training_start_date > DATE_SUB(NOW(), INTERVAL 60 DAY)";
             break;
         case '1quarter':
             $age = "training_start_date < NOW() AND training_start_date > DATE_SUB(NOW(), INTERVAL 96 DAY)";
             break;
         case '6months':
             $age = "training_start_date < NOW() AND training_start_date > DATE_SUB(NOW(), INTERVAL 185 DAY)";
             break;
         case 'all':
             $age = '1';
             break;
     }
     $trainings = $tableObj->getTrainingsAssign($id, $age);
     foreach ($trainings as $k => $r) {
         $trainings[$k]['input_checkbox'] = '<input type="checkbox" name="training_ids[]" value="' . $r['training_id'] . '">';
     }
     $this->view->assign('trainings', $trainings);
     $request = $this->getRequest();
     // save
     if ($request->isPost()) {
         $status = ValidationContainer::instance();
         $training_ids = $this->getSanParam('training_ids');
         if ($training_ids) {
             require_once 'models/table/PersonToTraining.php';
             foreach ($training_ids as $training_id) {
                 $tableObj = new PersonToTraining();
                 $result = $tableObj->addPersonToTraining($id, $training_id);
             }
             $status->setStatusMessage(t('The') . ' ' . t('Training') . t('(s) have been assigned.'));
             $status->setRedirect('/person/edit/id/' . $id);
         } else {
             $status->setStatusMessage(t('No') . ' ' . t('Trainings') . ' ' . t('selected') . '.');
         }
         $this->sendData($status);
     }
 }
开发者ID:falafflepotatoe,项目名称:trainsmart-code,代码行数:54,代码来源:PersonController.php

示例13: jsonContacts

 function jsonContacts($_index = null, $_cache = null)
 {
     $_JSON = array();
     $_QUERY = array();
     $contacts = array();
     $_JSON['error'] = '';
     $_JSON['code'] = '';
     $config = Config::get('API');
     if (Auth::check()) {
         $credits = Auth::user()->credits;
         $subscriptions = Auth::user()->subscription()->first();
         if ($subscriptions != null) {
             $transactions = $subscriptions->transaction()->get();
             if (count($transactions) > 0) {
                 foreach ($transactions as $transaction) {
                     $credits = $credits + $transaction->credits;
                 }
             }
         }
         $_JSON['error'] = '';
         if ($credits == 0) {
             $_JSON['error'] = 'You don&#39;t have sufficient funds to purchase contacts';
         } else {
             $index = Input::get('index', 0);
             $user = User::find(Auth::user()->id);
             if ($_cache == null) {
                 $CONTACTS = unserialize($user->cache);
             } else {
                 $CONTACTS = $_cache;
             }
             if (count($CONTACTS) > 0) {
                 $FIELD = $CONTACTS[$index];
                 $www = explode(" ", trim($FIELD['www']));
                 for ($i = 0; $i < count($www); $i++) {
                     $www[$i] = explode('www.', $www[$i]);
                     if (!empty($www[$i][1])) {
                         $www[$i] = $www[$i][1];
                     } else {
                         $www[$i] = $www[$i][0];
                     }
                 }
                 $www = array_unique($www);
                 /*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
                 $first_last = "&firstname=" . urlencode($FIELD['name']) . "&lastname=" . urlencode($FIELD['lastname']);
                 $last_first = "&firstname=" . urlencode($FIELD['lastname']) . "&lastname=" . urlencode($FIELD['name']);
                 $_QUERY[0] = $first_last . "&name=" . urlencode($FIELD['company_name']);
                 $_QUERY[1] = $first_last . "&name=";
                 /*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
                 $url = $config['api_jigsaw']['url'] . "/rest/searchContact.json?token=" . $config['api_jigsaw']['token'];
                 $i = 0;
                 /*----------------------------------------------------------------------------*/
                 $www_crawled = $this->searchCompany($FIELD['company_name']);
                 if (!empty($www_crawled)) {
                     foreach ($www_crawled as $key => $w) {
                         $www[] = $key;
                     }
                 }
                 $_www = array();
                 for ($w = 0; $w < count($www); $w++) {
                     if (!empty($www[$w])) {
                         if (!empty($www_crawled[$www[$w]])) {
                             $_www[] = $www[$w];
                         }
                     }
                 }
                 $www = $_www;
                 try {
                     if (count($contacts) == 0) {
                         if ($config['api_jigsaw']['status'] == true) {
                             $param = "&offset=0&pageSize=400" . $_QUERY[$i];
                             $json = file_get_contents($url . $param);
                             $decode = json_decode($json);
                             $contacts = $decode->contacts;
                             $this->saveContacts($contacts, $www[0], $www_crawled[$www[0]], serialize($www_crawled));
                         }
                         $CONTACTS[$index]['www'] = $www[0];
                         $CONTACTS[$index]['company_linkedin_www'] = $www_crawled[$www[0]];
                         $CONTACTS[$index]['www_variants'] = serialize($www_crawled);
                     }
                 } catch (Exception $e) {
                     Log::notice($e->getMessage());
                 }
                 $WWW = "";
                 $ino = 0;
                 $www = array_unique($www);
                 for ($w = 0; $w < count($www); $w++) {
                     if (!empty($www[$w])) {
                         $temp = explode('/', $www[$w]);
                         if (!empty($temp[1])) {
                             $www[$w] = $temp[0];
                         }
                     }
                 }
                 //Log::notice($www);
                 $CONTACTS[$index]['variants'] = implode(' ', $www);
                 /*----------------------------------------------------------------------------*/
                 $i = 1;
                 $_www = array();
                 for ($w = 0; $w < count($www); $w++) {
                     if (!empty($www[$w])) {
//.........这里部分代码省略.........
开发者ID:jadoonz,项目名称:Code-Sample,代码行数:101,代码来源:SearchController(Laravel).php

示例14: buildExcel

 /**
  * Turn our results into an Excel document
  *
  * @access  public
  * @public  array      $result      Existing result set (null to do new search)
  * @return  string                  Excel document
  */
 public function buildExcel($result = null)
 {
     // First, get the search results if none were provided
     // (we'll go for 50 at a time)
     if (is_null($result)) {
         $this->limit = 2000;
         $result = $this->processSearch(false, false);
     }
     // Prepare the spreadsheet
     ini_set('include_path', ini_get('include_path' . ';/PHPExcel/Classes'));
     include 'PHPExcel.php';
     include 'PHPExcel/Writer/Excel2007.php';
     $objPHPExcel = new PHPExcel();
     $objPHPExcel->getProperties()->setTitle("Search Results");
     $objPHPExcel->setActiveSheetIndex(0);
     $objPHPExcel->getActiveSheet()->setTitle('Results');
     //Add headers to the table
     $sheet = $objPHPExcel->getActiveSheet();
     $curRow = 1;
     $curCol = 0;
     $sheet->setCellValueByColumnAndRow($curCol++, $curRow, 'First Name');
     $sheet->setCellValueByColumnAndRow($curCol++, $curRow, 'Last Name');
     $sheet->setCellValueByColumnAndRow($curCol++, $curRow, 'Birth Date');
     $sheet->setCellValueByColumnAndRow($curCol++, $curRow, 'Death Date');
     $sheet->setCellValueByColumnAndRow($curCol++, $curRow, 'Veteran Of');
     $sheet->setCellValueByColumnAndRow($curCol++, $curRow, 'Cemetery');
     $sheet->setCellValueByColumnAndRow($curCol++, $curRow, 'Addition');
     $sheet->setCellValueByColumnAndRow($curCol++, $curRow, 'Block');
     $sheet->setCellValueByColumnAndRow($curCol++, $curRow, 'Lot');
     $sheet->setCellValueByColumnAndRow($curCol++, $curRow, 'Grave');
     $maxColumn = $curCol - 1;
     for ($i = 0; $i < count($result['response']['docs']); $i++) {
         $curDoc = $result['response']['docs'][$i];
         $curRow++;
         $curCol = 0;
         //Get supplemental information from the database
         require_once ROOT_DIR . '/sys/Genealogy/Person.php';
         $person = new Person();
         $id = str_replace('person', '', $curDoc['id']);
         $person->personId = $id;
         if ($person->find(true)) {
             //Output the row to excel
             $sheet->setCellValueByColumnAndRow($curCol++, $curRow, isset($curDoc['firstName']) ? $curDoc['firstName'] : '');
             $sheet->setCellValueByColumnAndRow($curCol++, $curRow, isset($curDoc['lastName']) ? $curDoc['lastName'] : '');
             $sheet->setCellValueByColumnAndRow($curCol++, $curRow, $person->formatPartialDate($person->birthDateDay, $person->birthDateMonth, $person->birthDateYear));
             $sheet->setCellValueByColumnAndRow($curCol++, $curRow, $person->formatPartialDate($person->deathDateDay, $person->deathDateMonth, $person->deathDateYear));
             $sheet->setCellValueByColumnAndRow($curCol++, $curRow, isset($curDoc['veteranOf']) ? implode(', ', $curDoc['veteranOf']) : '');
             $sheet->setCellValueByColumnAndRow($curCol++, $curRow, isset($curDoc['cemeteryName']) ? $curDoc['cemeteryName'] : '');
             $sheet->setCellValueByColumnAndRow($curCol++, $curRow, $person->addition);
             $sheet->setCellValueByColumnAndRow($curCol++, $curRow, $person->block);
             $sheet->setCellValueByColumnAndRow($curCol++, $curRow, $person->lot);
             $sheet->setCellValueByColumnAndRow($curCol++, $curRow, $person->grave);
         }
     }
     for ($i = 0; $i < $maxColumn; $i++) {
         $sheet->getColumnDimensionByColumn($i)->setAutoSize(true);
     }
     //Output to the browser
     header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
     header("Cache-Control: no-store, no-cache, must-revalidate");
     header("Cache-Control: post-check=0, pre-check=0", false);
     header("Pragma: no-cache");
     header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
     header('Content-Disposition: attachment;filename="Results.xlsx"');
     $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
     $objWriter->save('php://output');
     //THIS DOES NOT WORK WHY?
     $objPHPExcel->disconnectWorksheets();
     unset($objPHPExcel);
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:77,代码来源:Genealogy.php

示例15: pageList

 public function pageList($p, $z)
 {
     $this->assign('people', Person::find());
 }
开发者ID:rgigger,项目名称:zinc,代码行数:4,代码来源:ZoneUser.php


注:本文中的Person::find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。